From 6c6779478050402eb70dbc8a0720efd2d207c49c Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Wed, 9 Oct 2024 20:32:58 +0200 Subject: [PATCH] Add basic Proxy support. (#346) --- changelogs/fragments/346-proxy-env.yml | 5 +++++ src/antsibull_docs/cli/doc_commands/collection.py | 2 +- src/antsibull_docs/cli/doc_commands/devel.py | 2 +- src/antsibull_docs/cli/doc_commands/stable.py | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/346-proxy-env.yml diff --git a/changelogs/fragments/346-proxy-env.yml b/changelogs/fragments/346-proxy-env.yml new file mode 100644 index 00000000..624e0738 --- /dev/null +++ b/changelogs/fragments/346-proxy-env.yml @@ -0,0 +1,5 @@ +minor_changes: + - "Use Proxy configuration settings from the environment. Check out the + `aiohttp documentation on Proxy support `__ + for information on which environment variables are supported + (https://github.com/ansible/ansible-documentation/issues/1936, https://github.com/ansible-community/antsibull-docs/pull/346)." diff --git a/src/antsibull_docs/cli/doc_commands/collection.py b/src/antsibull_docs/cli/doc_commands/collection.py index 0f7c10c1..4abc1637 100644 --- a/src/antsibull_docs/cli/doc_commands/collection.py +++ b/src/antsibull_docs/cli/doc_commands/collection.py @@ -78,7 +78,7 @@ async def retrieve( requestors = {} lib_ctx = app_context.lib_ctx.get() - async with aiohttp.ClientSession() as aio_session: + async with aiohttp.ClientSession(trust_env=True) as aio_session: context = await GalaxyContext.create(aio_session, galaxy_server=galaxy_server) async with asyncio_pool.AioPool(size=lib_ctx.thread_max) as pool: downloader = CollectionDownloader( diff --git a/src/antsibull_docs/cli/doc_commands/devel.py b/src/antsibull_docs/cli/doc_commands/devel.py index b276fe0a..5f675af2 100644 --- a/src/antsibull_docs/cli/doc_commands/devel.py +++ b/src/antsibull_docs/cli/doc_commands/devel.py @@ -60,7 +60,7 @@ async def retrieve( requestors = {} lib_ctx = app_context.lib_ctx.get() - async with aiohttp.ClientSession() as aio_session: + async with aiohttp.ClientSession(trust_env=True) as aio_session: context = await GalaxyContext.create(aio_session, galaxy_server=galaxy_server) async with asyncio_pool.AioPool(size=lib_ctx.thread_max) as pool: if not use_installed_ansible_core: diff --git a/src/antsibull_docs/cli/doc_commands/stable.py b/src/antsibull_docs/cli/doc_commands/stable.py index 25d1a52b..6a3ee7c2 100644 --- a/src/antsibull_docs/cli/doc_commands/stable.py +++ b/src/antsibull_docs/cli/doc_commands/stable.py @@ -63,7 +63,7 @@ async def retrieve( requestors = {} lib_ctx = app_context.lib_ctx.get() - async with aiohttp.ClientSession() as aio_session: + async with aiohttp.ClientSession(trust_env=True) as aio_session: context = await GalaxyContext.create(aio_session, galaxy_server=galaxy_server) async with asyncio_pool.AioPool(size=lib_ctx.thread_max) as pool: if not use_installed_ansible_core: