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.

classification
Title: urllib proxy interface is too limited
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: Ankur.Ankan, Dominique.Leuenberger, numerodix, orsenthil, ronaldoussoren, tshepang
Priority: normal Keywords:

Created on 2010-03-07 11:22 by ronaldoussoren, last changed 2022-04-11 14:56 by admin.

Messages (2)
msg100573 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-03-07 11:22
The proxy support code in urllib is imho too specific and cannot easily support dynamic proxy configuration using a proxy.pac file.

That is, the code assumes that there is at most one proxy per protocol, while this is not quite true in practice.  A proxy.pac can refer different URLs to different proxies (or exclude some from proxying).

This could be solved by adding a new proxy hook to urllib, something like:

def getproxies_for_url(url) -> [info, ...]

That is, the argument is the string for an URL, the result is a list of proxies that can be used to fetch the URL.

This hook would allow us to provide a hook on OSX that enables python scripts to use the system proxy settings, even when those are complex (such as by using proxy autoconfiguration).
msg100714 - (view) Author: Dominique Leuenberger (Dominique.Leuenberger) Date: 2010-03-09 10:58
I like the idea of having the proxy handler expanded. In fact I suggest to base the idea on libproxy ( http://code.google.com/p/libproxy ) which is available on Linux / openSolaris / Windows and Mac (currently).

Libproxy queries the correct settings to be used from KDE and gnome, depending on the currently running session. A fallback is of course env.

the API of libproxy is very simple and python bindings are available.
History
Date User Action Args
2022-04-11 14:56:58adminsetgithub: 52330
2013-10-20 18:22:13numerodixsetnosy: + numerodix
2013-05-28 11:00:53Ankur.Ankansetnosy: + Ankur.Ankan
2013-05-27 15:44:33orsenthilsetassignee: orsenthil

nosy: + orsenthil
2013-05-26 11:19:53tshepangsetnosy: + tshepang

versions: + Python 3.4, - Python 2.7, Python 3.2
2010-03-09 10:58:28Dominique.Leuenbergersetnosy: + Dominique.Leuenberger
messages: + msg100714
2010-03-07 11:22:53ronaldoussorencreate