urllib2 weirdness when https_proxy environment variable is exported

John J. Lee jjl at pobox.com
Sat Oct 27 12:50:51 EDT 2007


Devraj <devraj at gmail.com> writes:

> I have been extensively using Python's urllib2 while developing a
> project with the Google Data API. The Google Data API uses httplib to
> place all of its requests. However I have been using urllib2 and some
> handlers that I discovered in an ASPN article to handle HTTPS proxies
> in my code.
>
> The Google Data API relies on an environment variable called
> https_proxy to get information about the proxy to be used. However
> urllib2 starts spitting out the BadStatusLine exception if the
> https_proxy environment variable is found.
[...]

This is because urllib2 does not support HTTPS proxies (neither does
urllib).  See Python cookbook for a hack to get it working.


John



More information about the Python-list mailing list