Issue 7154: urllib.request system proxy configuration lookup broken for OS X in Python 3 (original) (raw)

On OS X, urllib.request in Python 3 is supposed to use the operating system's proxy configuration by default, unless overridden by environment variables or by the caller providing an explicit proxy configuration.

In Python 2, urllib (and, indirectly, urllib2) were modified to use the OS X SystemConfiguration framework API instead of the obsolete classic MacOS Internet Configuration via the deprecated Macintosh ic library module, which was removed in Python 3.

However, in the transition from Python 2 urllib/urllib2 to Python 3 urllib.request, the changes to the darwin-specific getproxies functions were not made. So, at the moment, Python 3 urllib.request tries to import the non-existant ic module and silently fails, effectively ignoring the system proxy configuration. The solution is to forward port the corresponding code from Python 2 urllib along with the helper module _scproxy.c.