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

Setting app=... or transport=... should bypass environment proxies. #1122

Merged
merged 2 commits into from
Aug 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions httpx/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def trust_env(self) -> bool:
return self._trust_env

def _get_proxy_map(
self, proxies: typing.Optional[ProxiesTypes], trust_env: bool,
self, proxies: typing.Optional[ProxiesTypes], allow_env_proxies: bool,
) -> typing.Dict[str, typing.Optional[Proxy]]:
if proxies is None:
if trust_env:
if allow_env_proxies:
return {
key: None if url is None else Proxy(url=url)
for key, url in get_environment_proxies().items()
Expand Down Expand Up @@ -473,7 +473,8 @@ def __init__(
)
limits = pool_limits

proxy_map = self._get_proxy_map(proxies, trust_env)
allow_env_proxies = trust_env and app is None and transport is None
proxy_map = self._get_proxy_map(proxies, allow_env_proxies)

self._transport = self._init_transport(
verify=verify,
Expand Down Expand Up @@ -1003,7 +1004,8 @@ def __init__(
)
limits = pool_limits

proxy_map = self._get_proxy_map(proxies, trust_env)
allow_env_proxies = trust_env and app is None and transport is None
proxy_map = self._get_proxy_map(proxies, allow_env_proxies)

self._transport = self._init_transport(
verify=verify,
Expand Down