Search Results

Search found 1 results on 1 pages for 'eterry28'.

Page 1/1 | 1 

  • python unhashable type - posting xml data

    - by eterry28
    First, I'm not a python programmer. I'm an old C dog that's learned new Java and PHP tricks, but python looks like a pretty cool language. I'm getting an error that I can't quite follow. The error follows the code below. import httplib, urllib url = "pdb-services-beta.nipr.com" xml = '<?xml version="1.0"?><!DOCTYPE SCB_Request SYSTEM "http://www.nipr.com/html/SCB_XML_Request.dtd"><SCB_Request Request_Type="Create_Report"><SCB_Login_Data CustomerID="someuser" Passwd="somepass" /><SCB_Create_Report_Request Title=""><Producer_List><NIPR_Num_List_XML><NIPR_Num NIPR_Num="8980608" /><NIPR_Num NIPR_Num="7597855" /><NIPR_Num NIPR_Num="10166016" /></NIPR_Num_List_XML></Producer_List></SCB_Create_Report_Request></SCB_Request>' params = {} params['xmldata'] = xml headers = {} headers['Content-type'] = 'text/xml' headers['Accept'] = '*/*' headers['Content-Length'] = "%d" % len(xml) connection = httplib.HTTPSConnection(url) connection.set_debuglevel(1) connection.request("POST", "/pdb-xml-reports/scb_xmlclient.cgi", params, headers) response = connection.getresponse() print response.status, response.reason data = response.read() print data connection.close Here's the error: Traceback (most recent call last): File "C:\Python27\tutorial.py", line 14, in connection.request("POST", "/pdb-xml-reports/scb_xmlclient.cgi", params, headers) File "C:\Python27\lib\httplib.py", line 958, in request self._send_request(method, url, body, headers) File "C:\Python27\lib\httplib.py", line 992, in _send_request self.endheaders(body) File "C:\Python27\lib\httplib.py", line 954, in endheaders self._send_output(message_body) File "C:\Python27\lib\httplib.py", line 818, in _send_output self.send(message_body) File "C:\Python27\lib\httplib.py", line 790, in send self.sock.sendall(data) File "C:\Python27\lib\ssl.py", line 229, in sendall v = self.send(data[count:]) TypeError: unhashable type My log file says that the xmldata parameter is empty. Any ideas?

    Read the article

1