Python & SSL

John J. Lee jjl at
Wed May 3 04:06:22 CEST 2006

James Stroud <jstroud at> writes:

> I have been trying to make an https client with python, but it seems 

What exactly do you mean by "make an https client"?

> that, to do this, one needs to have the socket module compiled with ssl. 
> This is not the default. So I have a couple of questions.
>        1. Where do I specify to compile socket with ssl? I found no
>           obvious option in configure or or several other
>           files I checked.

What OS are you on?

>        2. Is there a way to do this without re-compiling all of python?

Are you sure it's NOT compiled in?  But, if it's not compiled, it's
not compiled.

> Also, I have done numerous combinations of searches with ssl, https, & 
> python as terms, but I haven't found a page outlining the steps to make 
> a certificate and key that python understands. Has anyone been 
> successful at this? Did you use openssl? I want to make sure I am doing 
> this part correctly.

Since you say "make a certificate", and mention "https client", it
sounds like you want to authenticate yourself to an HTTP server using
an SSL certificate?  If so, I don't believe the issue Benji raised is
relevant (that issue is relevant for fetching HTTPS URLs rather than
authenticating yourself to a server using an SSL certificate, I

urllib claims to have support for this in the form of the key_file and
cert_file arguments to Urlopener constructor (UNTESTED):

import urllib
opener = urllib.URLopener(key_file="/path/to/my_key_file",
response =

I can't claim to know that it actually works, though...


More information about the Python-list mailing list