Python
NOTE: The documentation below assumes either
FIXIE_URLorFIXIE_SOCKS_HOSTEnvironment Variables are set. If your application is deployed on either Heroku or Vercel via our official integration, these environments will be set for you. Otherwise, see the setup guide for the platform you are using in the Platforms section below for how to set them manually.
Fixie works with any http client library, including urllib2 from the standard library and third-party packages including the popular requests package.
Using requests
To route a specific request through Fixie using requests:
If you intend to route all outbound traffic through Fixie, a simpler option is to set the http_proxy and https_proxy environment variables. Both urllib2 and requests honor the http_proxy and https_proxy environment variables, so you can route all outbound requests through Fixie using these environment variables:
Using urllib2
Using urllib2 to send a specific request through Fixie:
The
urllib2API is significantly more verbose than that of therequestspackage. Therequestspackage is a better choice for most applications.
Related static IP guides
Platform-specific guides for giving your Python app a static outbound IP:
- Python on Heroku → API
- Python on Vercel → API
- Python on Render → Postgres
- Python on AWS Lambda → API
- Python on Fly.io → API
- Python on Heroku → Postgres
See the full list of static IP guides for every supported language, platform, and destination.
Is this guide useful?
Having issues? Please reach out to our team here.