Httpx: Add support for the NO_PROXY environment variable

Created on 19 Sep 2019  路  11Comments  路  Source: encode/httpx

The NO_PROXY environment variable is described here:

In order to accomplish this task we'd need:

  • Implementing NO_PROXY, a list of hosts that will bypass the proxy if found within the list.
  • Only enabled if trust_env=True
  • Documentation updates for the new environment variable.
  • Test cases for all code branches.
proxies requests-compat

Most helpful comment

@sethmlarson Hi Seth!

I would love to work on this if I could!

I'm mostly familiar with this library as a user but I think the context provided should be clear enough to adapt this for httpx.

All 11 comments

@sethmlarson Hi Seth!

I would love to work on this if I could!

I'm mostly familiar with this library as a user but I think the context provided should be clear enough to adapt this for httpx.

That would be awesome!! I'll assign the issue to you :)

If you have questions or doubts feel free to reach out here and we'll try our best to help.

Looks good.
Related to #404. I wonder if cURL would be a good baseline set of environment variables to adhere too? That's probably more robust and mature than any other tooling out there, so I'd be okay with us explicitly following their lead.

@sethmlarson hello! is someone working on this? if not, i'd like to try it

Feel free to go ahead @mariaS210! 馃帀

Reopening this, since it's evidently been closed in error - #471 adds NO_PROXY handling utility functions, but doesn't tie it in to the client.

Is there another way to bypass the proxies while waiting for NO_PROXY to be tied into the client?

You can use trust_env=False to disable system proxies.

https://www.python-httpx.org/environment_variables/

I have addressed this in https://github.com/encode/httpx/pull/835

@florimondmanca Would you want to close this issue now?

Was this page helpful?
0 / 5 - 0 ratings