urllib2 weirdness when https_proxy environment variable is exported

Devraj devraj at gmail.com
Mon Oct 29 05:58:54 EDT 2007


Hi John,

Thanks for that.

Do you have any web urls that I can see an example of the hack?


On Oct 28, 3:50 am, j... at pobox.com (John J. Lee) wrote:
> Devraj <dev... 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