Skip to content

Commit a5e725f

Browse files
Respect the HTTP_PROXY environment variable
While `requests` used to respect the HTTP_PROXY and HTTPS_PROXY environment variables, `aiohttp` does not do so by default [1]. Trust the environment variables to enable the use of proxies. [1]: https://docs.aiohttp.org/en/stable/client_advanced.html#proxy-support Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.com>
1 parent 3ff5dd5 commit a5e725f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/python_inspector/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ async def get_response_async(url: str) -> Optional[Dict]:
8989
Return a mapping of the JSON response from fetching ``url``
9090
or None if the ``url`` cannot be fetched.
9191
"""
92-
async with aiohttp.ClientSession() as session:
92+
async with aiohttp.ClientSession(trust_env=True) as session:
9393
async with session.get(url) as response:
9494
if response.status == 200:
9595
return await response.json()

src/python_inspector/utils_pypi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,7 @@ async def get_remote_file_content(
18061806
if login and password:
18071807
auth = aiohttp.BasicAuth(login, password)
18081808

1809-
async with aiohttp.ClientSession() as session:
1809+
async with aiohttp.ClientSession(trust_env=True) as session:
18101810
async with session.get(url, allow_redirects=True, headers=headers, auth=auth) as response:
18111811
status = response.status
18121812
if status != requests.codes.ok: # NOQA

0 commit comments

Comments
 (0)