Hello all, I have the following function:
def soap(self, xml):
""" Transport function """
slash = self.apiurl.find('/')
addr = self.apiurl[:slash]
path = self.apiurl[slash:]
conn = httplib.HTTPSConnection(addr)
conn.putrequest("POST", path)
conn.putheader("Content-type", "text/xml; charset=\"UTF-8\"")
conn.putheader("Content-length", "%d" % len(xml))
conn.endheaders()
conn.send(xml)
rez = conn.getresponse()
content = rez.read()
conn.close()
return rez, content
When I'm trying to connect to the server with this function, I'm receiving following error:
conn.endheaders()
File "/usr/lib/python2.6/httplib.py", line 908, in endheaders
self._send_output()
File "/usr/lib/python2.6/httplib.py", line 780, in _send_output
self.send(msg)
File "/usr/lib/python2.6/httplib.py", line 739, in send
self.connect()
File "/usr/lib/python2.6/httplib.py", line 1116, in connect
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
File "/usr/lib/python2.6/ssl.py", line 338, in wrap_socket
suppress_ragged_eofs=suppress_ragged_eofs)
File "/usr/lib/python2.6/ssl.py", line 120, in __init__
self.do_handshake()
File "/usr/lib/python2.6/ssl.py", line 279, in do_handshake
self._sslobj.do_handshake()
Python 2.6. The strange thing, is that when I try to connect second time in a second - it's working without any problem. How to overcome this problem with SSL? What I'm doing wrong? Thank you in advance.