Skip to content

urllib proxy interface is too limited #52330

Open

Description

@ronaldoussoren
BPO 8083
Nosy @ronaldoussoren, @orsenthil

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/orsenthil'
closed_at = None
created_at = <Date 2010-03-07.11:22:53.071>
labels = ['type-feature', 'library']
title = 'urllib proxy interface is too limited'
updated_at = <Date 2013-10-20.18:22:13.381>
user = 'https://github.com/ronaldoussoren'

bugs.python.org fields:

activity = <Date 2013-10-20.18:22:13.381>
actor = 'numerodix'
assignee = 'orsenthil'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2010-03-07.11:22:53.071>
creator = 'ronaldoussoren'
dependencies = []
files = []
hgrepos = []
issue_num = 8083
keywords = []
message_count = 2.0
messages = ['100573', '100714']
nosy_count = 6.0
nosy_names = ['ronaldoussoren', 'orsenthil', 'Dominique.Leuenberger', 'tshepang', 'Ankur.Ankan', 'numerodix']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue8083'
versions = ['Python 3.4']

Linked PRs

Activity

  1. ronaldoussoren commented on Mar 7, 2010

    @ronaldoussoren
    ContributorAuthor

    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).

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    type-featureA feature request or enhancement
    on Mar 7, 2010
  3. DominiqueLeuenberger commented on Mar 9, 2010

    DominiqueLeuenbergermannequin
    Mannequin

    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.

  4. self-assigned this
    on May 27, 2013
  5. transferred this issue fromon Apr 10, 2022
  6. orsenthil commented on Nov 8, 2026

    @orsenthil
    Member

    Current libproxy reference - https://github.com/libproxy/libproxy

    If we link against this maintained library and pass the proxy handling configuration to be handled by the library, that would be a better idea than re-implementing parts of this library in python.

  7. orsenthil commented on Nov 9, 2026

    @orsenthil
    Member

    This request will be best be handled by https://pypac.readthedocs.io/en/latest/

    If we document how to use urllib.request with pypac, it will be sufficient to address and close this ticket, in my opinion.

  8. orsenthil commented on Nov 10, 2026

    @orsenthil
    Member

    Here is a PR that explains how urllib interface can be used along with pypac pypi package - #161729

    I had a driver function to test this - https://github.com/orsenthil/urllib-pac-recipe and verify that suggested approach in the documentation will work.

  9. moved this from Todo to In Progress in Urllib issueson Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions