Skip to content

Commit

Permalink
Added no proxy check for issue aio-libs#4431
Browse files Browse the repository at this point in the history
  • Loading branch information
scirelli-c1 committed Dec 15, 2019
1 parent d6f3f31 commit 01303f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ virtualenv.py
pip-wheel-metadata
.test-results
coverage.xml
.venv/
13 changes: 8 additions & 5 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
ceil_timeout,
get_running_loop,
proxies_from_env,
proxy_bypass,
sentinel,
strip_auth_from_url,
)
Expand Down Expand Up @@ -422,11 +423,13 @@ async def _request(
if proxy is not None:
proxy = URL(proxy)
elif self._trust_env:
for scheme, proxy_info in proxies_from_env().items():
if scheme == url.scheme:
proxy = proxy_info.proxy
proxy_auth = proxy_info.proxy_auth
break
if not proxy_bypass(str(url.host)):
for scheme, proxy_info in proxies_from_env()\
.items():
if scheme == url.scheme:
proxy = proxy_info.proxy
proxy_auth = proxy_info.proxy_auth
break

req = self._request_class(
method, url, params=params, headers=headers,
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
cast,
)
from urllib.parse import quote
from urllib.request import getproxies
from urllib.request import getproxies, proxy_bypass # noqa: F401

import async_timeout
import attr
Expand Down

0 comments on commit 01303f4

Please sign in to comment.