You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
trust_env is partially ignored for httpx.get calls #505
I have a socks5 proxy used in the system and it's not supported by httpx. all_proxy environmental variable points to socks5 proxy, therefore httpx.get('https://httpbin.org/get') call results in an error (Unknown proxy for URL).
To bypass that I specify trust_env=False like this httpx.get('https://httpbin.org/get', trust_env=False), but still get the same error.
I looked up the request method implementation in the api.py and apparently when the Client instance is created none of the request method parameters are being passed to the constructor.
Therefore inside the BaseClient's init method trust_env has the default value (True). And accordingly to this value tries to deduce the proxy settings from the environment variable, which causes the error.
It would be great if you passed the trust_env value to init when creating Client's instance.
Good catch, yup. I think we should only pass trust_env to the Client in that case, and not bother including it on the request (it will just default to the client value).
Stylistically I'd be tempted to do the same for timeout, cert, verify too, which are more typically per-client than per-request.
Activity
lovelydinosaur commentedon Nov 6, 2019
Good catch, yup. I think we should only pass
trust_envto the Client in that case, and not bother including it on the request (it will just default to the client value).Stylistically I'd be tempted to do the same for
timeout,cert,verifytoo, which are more typically per-client than per-request.lovelydinosaur commentedon Nov 27, 2019
Closed via #544