urllib2, proxies and https

John J. Lee jjl at pobox.com
Sun Aug 20 12:48:56 EDT 2006


Astan Chee <stanc at al.com.au> writes:

> Hi again,
> According to
> https://demo.launchpad.net/products/python/+bug/56872
> or more specifically, the example of its working code:
> http://librarian.demo.launchpad.net/3507227/urllib2_proxy_auth.py
> I can use urllib2 via proxy to access a https site(specifically
> hooking it up to libgmail).
[...]

The code at that URL seems to be claiming you CAN'T do that, even with
HTTP URLs (note HTTP, not HTTPS).  Hopefully (s)he is complaining
about 2.4 -- there are a bunch of bugs with this kind of thing fixed
in Python 2.5.

Re HTTPS: urllib2 does not support the CONNECT method (nor urllib, I
think), so no, you can't visit HTTPS URLS through a proxy with vanilla
urllib2.  There are some hacks lying around in the cookbook and on the
Python SF tracker showing how to do it, though.


John



More information about the Python-list mailing list