Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxy: urllib getproxies works with OS specific sources (like Windows registry) #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions python2/httplib2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,8 +1090,7 @@ def proxy_info_from_environment(method="http"):
if method not in ["http", "https"]:
return

env_var = method + "_proxy"
url = os.environ.get(env_var, os.environ.get(env_var.upper()))
url = urllib.getproxies().get(method)
if not url:
return
return proxy_info_from_url(url, method, None)
Expand Down Expand Up @@ -1628,7 +1627,7 @@ def __init__(
`proxy_info` may be:
- a callable that takes the http scheme ('http' or 'https') and
returns a ProxyInfo instance per request. By default, uses
proxy_nfo_from_environment.
proxy_info_from_environment.
- a ProxyInfo instance (static proxy config).
- None (proxy disabled).

Expand Down
5 changes: 2 additions & 3 deletions python3/httplib2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import ssl
import sys
import time
import urllib.parse
import urllib.parse, urllib.request
import zlib

try:
Expand Down Expand Up @@ -1071,8 +1071,7 @@ def proxy_info_from_environment(method="http"):
if method not in ("http", "https"):
return

env_var = method + "_proxy"
url = os.environ.get(env_var, os.environ.get(env_var.upper()))
url = urllib.request.getproxies().get(method)
if not url:
return
return proxy_info_from_url(url, method, noproxy=None)
Expand Down