Passing a custom transport disables environment proxies
#3514
Unanswered
RobertCraigie
asked this question in
Potential Issue
Replies: 1 comment
-
|
I was also confused with this behaviour. As for now, I have to manually pass environment proxies to from httpx import AsyncClient
from httpx._utils import get_environment_proxies
client = AsyncClient(
mounts={
pattern: CustomTransport(proxy=proxy, ...)
for pattern, proxy in get_environment_proxies().items()
},
...
)I think they should at lease describe this behaviour in the documentation if it's as designed, and what the best practice is if we do want to respect environment proxies with custom transports. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This behaviour was added in #1122 and I'm curious why
transportwas included?In anthropic-python we recently released an update that includes sending some TCP keep alive packets but incidentally this also broke environment proxies.
Additionally, it looks like the code used to read these environment variables is all private? How would we support both environment variables & a custom transport? Would we have to essentially duplicate the logic in
_get_proxy_map()and pass it tomounts?Beta Was this translation helpful? Give feedback.
All reactions