Skip to content
Myr

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

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Setting app= or transport= should bypass proxies * Tweak

authored by Tom Christie · committed by GitHub · parent e5f8743 · Browse files · 1 file+6 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−4 removed

  • other:+6 added−4 removed

1 file+6 added−4 removed

modified:httpx/_client.py+6 added-4 removed
87 unmodified lines
88 def trust_env(self) -> bool:89 return self._trust_env9091 def _get_proxy_map(92 self, proxies: typing.Optional[ProxiesTypes], trust_env: bool,92 self, proxies: typing.Optional[ProxiesTypes], allow_env_proxies: bool,93 ) -> typing.Dict[str, typing.Optional[Proxy]]:94 if proxies is None:95 if trust_env:95 if allow_env_proxies:96 return {97 key: None if url is None else Proxy(url=url)98 for key, url in get_environment_proxies().items()99 }
372 unmodified lines
472 "errors in the future. Use Client(..., limits=...) instead."473 )474 limits = pool_limits475476 allow_env_proxies = trust_env and app is None and transport is None476 proxy_map = self._get_proxy_map(proxies, trust_env)477 proxy_map = self._get_proxy_map(proxies, allow_env_proxies)478479 self._transport = self._init_transport(480 verify=verify,481 cert=cert,
521 unmodified lines
1003 "errors in the future. Use AsyncClient(..., limits=...) instead."1004 )1005 limits = pool_limits10061007 allow_env_proxies = trust_env and app is None and transport is None1006 proxy_map = self._get_proxy_map(proxies, trust_env)1008 proxy_map = self._get_proxy_map(proxies, allow_env_proxies)10091010 self._transport = self._init_transport(1011 verify=verify,1012 cert=cert,
497 unmodified lines