Basic Proxy Configuration
The simplest way to configure a proxy is by customizing the HTTP client:Environment Variables
You can also use environment variables to configure proxies globally:Authenticated Proxies
For proxies requiring authentication, include credentials in the proxy URL:Custom Proxy Configuration
For more advanced proxy configurations, you can customize the httpx transport:Different Proxies for HTTP and HTTPS
You can specify different proxies for HTTP and HTTPS:SOCKS Proxies
For SOCKS proxy support, install thehttpx[socks] extra:
Per-Request Proxy
You can configure proxies on a per-request basis usingwith_options():
Async Proxy Configuration
Proxy configuration works the same way with the async client:Disabling Proxies
To disable environment variable proxies for specific requests:Troubleshooting
Testing Proxy Connection
Verify your proxy configuration:Common Issues
Connection timeouts
Connection timeouts
Increase the timeout for proxy connections:
SSL/TLS verification errors
SSL/TLS verification errors
For corporate proxies with custom certificates, you may need to configure SSL verification:
Proxy authentication failures
Proxy authentication failures
Ensure your credentials are properly URL-encoded: