Setup Guides

How to Set Up Proxies in Python Requests

Route Python Requests traffic through an authenticated proxy in a few lines. Copy the code below and swap in your credentials.

Language Python Rotation Supported Category HTTP client

Quick answer

Set the proxy in the format http://user:pass@host:port and send your Python Requests request through it. Full code below.

Python Requests proxy example

import requests

proxies = {
    "http": "http://user:pass@host:port",
    "https": "http://user:pass@host:port",
}

resp = requests.get("https://httpbin.org/ip", proxies=proxies, timeout=15)
print(resp.json())

Requests reads the same proxy dict for both http and https keys, so authenticated HTTP and HTTPS backconnect endpoints work with one entry. Use a persistent requests.Session() when firing many calls so connections are pooled, and always set a timeout because a dead proxy will otherwise hang the thread. For SOCKS5 endpoints install the requests[socks] extra and switch the scheme to socks5h://.

Rotating proxies

Python Requests works cleanly with rotating backconnect endpoints — point it at a single gateway host and the provider rotates the exit IP for you.

Best proxies to use with Python Requests

1

Cheapest-Proxies.com EDITOR'S CHOICE

4.9

Best overall value across every proxy type and use case · flexible pay-as-you-go plans

Visit Cheapest-Proxies.com
2

Bright Data

4.6

Enterprise-grade proxy and web data platform · from ~$8-9/GB (residential, volume-dependent)

Read Bright Data review
3

Oxylabs

4.6

Premium enterprise proxies and scraper APIs · from ~$8/GB (residential, volume-dependent)

Read Oxylabs review
4

Smartproxy

4.5

User-friendly proxies with excellent price-to-performance · from ~$3.50-7/GB (residential)

Read Smartproxy review

Our #1 pick is a sponsored partner. Remaining providers are ranked editorially by rating and value.

Frequently Asked Questions

Does Python Requests support authenticated proxies?

Yes. Provide the username and password (as a URL or separate fields) and Python Requests handles the auth handshake.

Can Python Requests rotate proxies automatically?

Yes — point it at a rotating backconnect endpoint and the provider rotates IPs for you.

What proxies work best with Python Requests?

Residential or rotating proxies from a reliable provider give the best success rate for Python projects.

How do I add a proxy in Python Requests?

Supply the proxy as http://user:pass@host:port and pass it to Python Requests as shown in the code above.

Related Guides

Best proxies for Python Requests

For most buyers this provider hits the best balance of price and reliability — check current pricing.

Visit Cheapest-Proxies.com