This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jesstess
Recipients barry, jesstess
Date 2013-04-13.18:46:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1365878761.8.0.662633000106.issue7152@psf.upfronthosting.co.za>
In-reply-to
Content
I confirm Barry's observation in msg94150 that if you set http_proxy (or any `*_proxy` environment variable), ProxyHandler does show up in build_opener().handlers. You can also add a ProxyHandler to build_opener through the public API as described in http://docs.python.org/dev/library/urllib.request.html#examples.

I've attached a patch that updates the urllib2 and urllib.request documentation to clarify the situation. The patch also adds a missing DataHandler to the enumerated default handlers in the urllib2 note on basic authentication.

I built the documentation and inspected the generated HTML to confirm proper formatting.

--

As a side note on what's going on with ProxyHandler's interaction with `if meth in ["redirect_request", "do_open", "proxy_open"]:`, since this was confusing to me until I dug into the source a bit:

When you don't have any proxy environment variables set, ProxyHandler only has one <protocol>_<condition> method that might get the handler registered -- proxy_open -- which gets skipped because of the above blacklisted methods check. When a proxy environment variable is set, ProxyHandler grows a *_open method which does get it registered as a handler.
History
Date User Action Args
2013-04-13 18:46:01jesstesssetrecipients: + jesstess, barry
2013-04-13 18:46:01jesstesssetmessageid: <1365878761.8.0.662633000106.issue7152@psf.upfronthosting.co.za>
2013-04-13 18:46:01jesstesslinkissue7152 messages
2013-04-13 18:46:01jesstesscreate