Python SSL Socket issue

lauras laura.skosnik at gmail.com
Tue Apr 19 20:09:06 EDT 2005


Hello,

We are having an issue with Python SSL sockets using Apache and mod_python.  

When we try to get an SSL connection using the following code:

            con = httplib.HTTPSConnection( self.HOST, self.PORT )
            #con.set_debuglevel(10)
            con.putrequest( "POST", "" )
            con.putheader( "Content-Type", "text/xml" )
            con.putheader( "content-length", int(len(cmd)) )
            con.endheaders()
            con.send( cmd )

We get the following error:

         con.endheaders()
        File "/usr/lib/python2.3/httplib.py", line 715, in endheaders
         self._send_output()
        File "/usr/lib/python2.3/httplib.py", line 600, in _send_output
         self.send(msg)
        File "/usr/lib/python2.3/httplib.py", line 567, in send
         self.connect()
        File "/usr/lib/python2.3/httplib.py", line 988, in connect
         ssl = socket.ssl(sock, self.key_file, self.cert_file)
        File "/usr/lib/python2.3/socket.py", line 73, in ssl
         return _realssl(sock, keyfile, certfile)
     TypeError: ssl() argument 1 must be _socket.socket, not _socketobject


Has anyone encountered this before or has any suggestions?

Thanks,
Laura



More information about the Python-list mailing list