python-requests Using requests behind a proxy Using proxy environment variables

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

requests uses specific environment variables automatically for proxy detection.

  • HTTP_PROXY will define the proxy URL to use for HTTP connections
  • HTTPS_PROXY will define the proxy URL to use for HTTPS connections

Once these environment variables are set, the Python code does not need to pass anything to the proxies parameter.

requests.get('http://example.com')


Got any python-requests Question?