NOTE: The documentation below assumes either FIXIE_URL or FIXIE_SOCKS_HOST Environment Variables are set. If your application is deployed on either Heroku or Vercel via our official integration, these environments will be set for you.

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:

import os, requests
proxyDict = {
              "http"  : os.environ.get('FIXIE_URL', ''),
              "https" : os.environ.get('FIXIE_URL', '')
r = requests.get('', proxies=proxyDict)

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:

import os, requests
os.environ['http_proxy'] = os.environ.get('FIXIE_URL', '')
os.environ['https_proxy'] = os.environ.get('FIXIE_URL', '')

Using urllib2

Using urllib2 to send a specific request through Fixie:

import os, urllib2
proxy  = urllib2.ProxyHandler({'http': os.environ.get('FIXIE_URL', '')})
auth   = urllib2.HTTPBasicAuthHandler()
opener = urllib2.build_opener(proxy, auth, urllib2.HTTPHandler)
response ='')
html =

The urllib2 API is significantly more verbose than that of the requests package. The requests package is a better choice for most applications.

Having issues? Please reach out to our team here.