This issue was rewritten on 7 August 2026. The original version asked for the wrong fix and @slegarraga implemented it faithfully in #152 before I caught it. The reasoning and the evidence are in this comment; the short version is that moving proxy credentials into a header breaks them for https downloads, which is all of them. The scope below is what the issue should have said in the first place.
Every test run prints this:
tests/test_proxy_pool.py::test_proxy_pool_load_valid
moon_download.py:114: DeprecationWarning: BasicAuth is deprecated and will be removed
in aiohttp 4.0; use aiohttp.encode_basic_auth() with headers={'Authorization': ...} instead
"auth": aiohttp.BasicAuth(user, passwd),
The BasicAuth call is staying. This issue is only about the noise in the test output.
Why the call stays
moon_download.py:114 builds proxy credentials, and they are handed to aiohttp as proxy_auth. That parameter accepts nothing else:
if proxy_auth and not isinstance(proxy_auth, helpers.BasicAuth):
raise ValueError("proxy_auth must be None or BasicAuth() tuple")
and helpers.BasicAuth(...) is what emits the warning. aiohttp has deprecated the only type its own proxy_auth parameter accepts, without shipping a replacement for that parameter.
Passing the credentials as a header instead is not a workaround — it changes what goes on the wire. For an https target aiohttp authenticates the proxy on a CONNECT request, so anything in headers= is sent inside the finished TLS tunnel where the proxy cannot read it. Both providers here serve https, so that breaks authenticated proxies on every real download while still passing every unit test. Do not do it.
requirements.txt pins aiohttp>=3.9,<4, so the upper bound holds the actual removal off. When aiohttp 4 ships a proxy-auth API, that is a separate issue and a real one.
The work
Give pytest a filterwarnings entry so this specific warning does not print. The repo has no pytest configuration file at all today, so this means creating one — either pytest.ini or a [tool.pytest.ini_options] block in a new pyproject.toml. Pick whichever you can justify in the PR body; I have no preference beyond it being a deliberate choice.
Two things the entry must get right:
- Target this warning only. A blanket
ignore::DeprecationWarning would hide every future deprecation in every dependency, which is a worse outcome than the noise. Match on the message or the module.
- Leave a comment pointing at this issue. Otherwise someone reads a suppressed warning in a year, "fixes" it properly, and re-introduces the bug described above. The comment is the actual deliverable here; the config line is two minutes.
Done when
pytest tests/ -q runs clean with no BasicAuth deprecation output
- An unrelated
DeprecationWarning would still be shown — check by adding one temporarily, or by matching narrowly enough that it is obvious from reading
moon_download.py is unchanged
- The config file explains why the suppression exists and links here
Small — genuinely small this time. Comment to claim it.
Every test run prints this:
The
BasicAuthcall is staying. This issue is only about the noise in the test output.Why the call stays
moon_download.py:114builds proxy credentials, and they are handed to aiohttp asproxy_auth. That parameter accepts nothing else:and
helpers.BasicAuth(...)is what emits the warning. aiohttp has deprecated the only type its ownproxy_authparameter accepts, without shipping a replacement for that parameter.Passing the credentials as a header instead is not a workaround — it changes what goes on the wire. For an https target aiohttp authenticates the proxy on a
CONNECTrequest, so anything inheaders=is sent inside the finished TLS tunnel where the proxy cannot read it. Both providers here serve https, so that breaks authenticated proxies on every real download while still passing every unit test. Do not do it.requirements.txtpinsaiohttp>=3.9,<4, so the upper bound holds the actual removal off. When aiohttp 4 ships a proxy-auth API, that is a separate issue and a real one.The work
Give pytest a
filterwarningsentry so this specific warning does not print. The repo has no pytest configuration file at all today, so this means creating one — eitherpytest.inior a[tool.pytest.ini_options]block in a newpyproject.toml. Pick whichever you can justify in the PR body; I have no preference beyond it being a deliberate choice.Two things the entry must get right:
ignore::DeprecationWarningwould hide every future deprecation in every dependency, which is a worse outcome than the noise. Match on the message or the module.Done when
pytest tests/ -qruns clean with noBasicAuthdeprecation outputDeprecationWarningwould still be shown — check by adding one temporarily, or by matching narrowly enough that it is obvious from readingmoon_download.pyis unchangedSmall — genuinely small this time. Comment to claim it.