---
title: "Python Requests Proxy: Setup, Rotation, and SOCKS5"
description: Configure HTTP and SOCKS5 proxies in Python Requests, rotate IPs, handle authentication, reduce blocks, and troubleshoot common proxy errors.
image: https://blog.froxy.com/hubfs/blog/python-requests-proxy/python-requests-proxy.png
---

<https://froxy.com/en>

 Products

- [Residential Proxies](https://froxy.com/en/residential-proxies)
- [Mobile Proxies](https://froxy.com/en/mobile-proxies)
- [Datacenter Proxies](https://froxy.com/en/datacenter-proxies)

 Prices

- [Residential Proxies](https://froxy.com/en/residential-proxies/pricing)
- [Mobile Proxies](https://froxy.com/en/mobile-proxies/pricing)
- [Datacenter Proxies](https://froxy.com/en/datacenter-proxies/pricing)

[Locations](https://froxy.com/en/locations)

English

- [English](https://blog.froxy.com/en?hsLang=en)
- [Русский](https://blog.froxy.com/ru/python-requests-proxy?hsLang=en)

[![Sign In](https://hubspot-no-cache-eu1-prod.s3.amazonaws.com/cta/default/25353777/15c02a99-178a-4cc8-a3e0-28aed8751f54.png)](https://hubspot-cta-redirect-eu1-prod.s3.amazonaws.com/cta/redirect/25353777/15c02a99-178a-4cc8-a3e0-28aed8751f54) [![Sign Up](https://hubspot-no-cache-eu1-prod.s3.amazonaws.com/cta/default/25353777/3a42d098-9158-495e-9ec2-6b4d242848d3.png)](https://hubspot-cta-redirect-eu1-prod.s3.amazonaws.com/cta/redirect/25353777/3a42d098-9158-495e-9ec2-6b4d242848d3)

<https://blog.froxy.com/en?hsLang=en>

- [Proxies](https://blog.froxy.com/en/tag/proxies)
- [Web Scraping](https://blog.froxy.com/en/tag/web-scraping)
- [Cases](https://blog.froxy.com/en/tag/cases)
- [News](https://blog.froxy.com/en/tag/news)
- [Privacy & Security](https://blog.froxy.com/en/tag/privacy-security)
- [Antidetect](https://blog.froxy.com/en/tag/antidetect)
- [Data](https://blog.froxy.com/en/tag/data)
- [AI](https://blog.froxy.com/en/tag/ai)
- [Search](https://blog.froxy.com/hs-search-results?hsLang=en)
- English
- [English](https://blog.froxy.com/en?hsLang=en)
- [Русский](https://blog.froxy.com/ru/python-requests-proxy?hsLang=en)
- Products
- [Residential Proxies](https://froxy.com/en/residential-proxies)
- [Mobile Proxies](https://froxy.com/en/mobile-proxies)
- [Datacenter Proxies](https://froxy.com/en/datacenter-proxies)
- Prices
- [Residential Proxies](https://froxy.com/en/residential-proxies/pricing)
- [Mobile Proxies](https://froxy.com/en/mobile-proxies/pricing)
- [Datacenter Proxies](https://froxy.com/en/datacenter-proxies/pricing)
- [Locations](https://froxy.com/en/locations)
- [![Sign In](https://hubspot-no-cache-eu1-prod.s3.amazonaws.com/cta/default/25353777/5ca78b96-0d2a-4059-a1fd-3d844ff0f963.png)](https://hubspot-cta-redirect-eu1-prod.s3.amazonaws.com/cta/redirect/25353777/5ca78b96-0d2a-4059-a1fd-3d844ff0f963)
- [![Sign Up](https://hubspot-no-cache-eu1-prod.s3.amazonaws.com/cta/default/25353777/938a4c38-5267-4627-bd2b-88eb5da0737a.png)](https://hubspot-cta-redirect-eu1-prod.s3.amazonaws.com/cta/redirect/25353777/938a4c38-5267-4627-bd2b-88eb5da0737a)

1. [Blog](https://blog.froxy.com/en?hsLang=en)
2. Python Requests Proxy: How to Set up and Rotate

Proxies

# Python Requests Proxy: How to Set up and Rotate

Configure HTTP and SOCKS5 proxies in Python Requests, rotate IPs, handle authentication, reduce blocks, and troubleshoot common proxy errors.

Team Froxy 15 May 2025 11 min read

[Facebook](http://www.facebook.com/share.php?u=https%3A%2F%2Fblog.froxy.com%2Fen%2Fpython-requests-proxy%3Futm_medium%3Dsocial%26utm_source%3Dfacebook) [linkedIn](http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fblog.froxy.com%2Fen%2Fpython-requests-proxy%3Futm_medium%3Dsocial%26utm_source%3Dlinkedin) [Twitter](https://twitter.com/intent/tweet?original_referer=https%3A%2F%2Fblog.froxy.com%2Fen%2Fpython-requests-proxy%3Futm_medium%3Dsocial%26utm_source%3Dtwitter&url=https%3A%2F%2Fblog.froxy.com%2Fen%2Fpython-requests-proxy%3Futm_medium%3Dsocial%26utm_source%3Dtwitter&source=tweetbutton&text=)

![Python Requests Proxy: How to Set up and Rotate](https://blog.froxy.com/hubfs/blog/python-requests-proxy/python-requests-proxy.png)

- [What Is Python Requests?](https://blog.froxy.com/en/python-requests-proxy#what-is-requests)
- [Python Requests Proxy Types](https://blog.froxy.com/en/python-requests-proxy#proxy-types)
- [Python Requests Proxy: Step-by-Step Setup](https://blog.froxy.com/en/python-requests-proxy#setup)
- [Common Errors and How to Fix Them](https://blog.froxy.com/en/python-requests-proxy#common-errors)
- [Best Practices and Security Considerations](https://blog.froxy.com/en/python-requests-proxy#best-practices)
- [Conclusion and Recommendations](https://blog.froxy.com/en/python-requests-proxy#conclusion)
- [FAQ](https://blog.froxy.com/en/python-requests-proxy#faq)

A Python Requests proxy works for one-off calls, but scraping at scale adds IP rotation, retries, and bot detection. This guide shows you how to configure the library, avoid common failures, and reduce unnecessary blocks.

You'll cover basic setup, authentication, HTTP and SOCKS5, session-level settings, IP rotation, and troubleshooting. The same patterns work for one script with one proxy or a larger IP pool.

Briefly, to route a request through a proxy, pass requests.get() a proxies dictionary with http and https keys. The site then sees the proxy's exit IP instead of your direct IP. Authentication, SOCKS5, sessions, and rotation build on that pattern.

## What Is Python Requests?

Python Requests is the standard high-level library for making HTTP requests in Python. It runs on urllib3 but exposes a much simpler API.

Key features include:

- HTTP methods: GET, POST, PUT, DELETE, and other common methods
- Session management: persistent cookies, headers, and connections through requests.Session
- Data formats: automatic Unicode decoding and built-in JSON handling
- Security controls: SSL/TLS certificate verification and request timeouts
- Proxy support: native HTTP/HTTPS support, plus SOCKS4/SOCKS5 through requests\[socks\]

Pass proxy settings directly with the request. You don't need a separate wrapper.

## Python Requests Proxy Types

![Python Requests Proxy Types](https://blog.froxy.com/hs-fs/hubfs/blog/python-requests-proxy/proxies.png?width=1548&height=409&name=proxies.png)

Requests supports three proxy schemes. The main difference is how each one handles traffic.

HTTP proxies accept a standard HTTP request, inspect it, and forward it to the destination. Use the http:// URL scheme.

HTTPS over an HTTP proxy works differently. The client sends CONNECT, and the proxy opens a TCP tunnel to the target host. TLS then runs directly between your script and the site, so the proxy sees the domain and traffic volume, not the payload.

SOCKS4/SOCKS5 proxies operate at the transport layer. They forward the TCP stream without parsing HTTP, so they don't add HTTP proxy headers. Requests needs the requests\[socks\] package for this mode.

The configuration stays the same: a proxies dictionary with http and https keys whose values contain proxy URLs. Only the URL scheme changes.

## Python Requests Proxy: Step-by-Step Setup

![Python Requests Proxy: Step-by-Step Setup](https://blog.froxy.com/hs-fs/hubfs/blog/python-requests-proxy/setup.png?width=1548&height=502&name=setup.png)

On Windows, add Python to the Path environment variable. Add pip as well so you can run the package manager from a terminal.

It should look like this:

![Python](https://blog.froxy.com/hs-fs/hubfs/blog/scrape-google-people-also-ask/1.png?width=889&height=500&name=1.png)

### Install Python Requests

Install requests first. Add the SOCKS package or curl\_cffi only if you need those features.

```
pip install requests
pip install requests[socks]   # for SOCKS5 support
pip install curl_cffi         # for browser-like TLS fingerprints (see below)
```

If your shell can't find pip, run python -m pip install requests. This bypasses common Path configuration issues.

### HTTP proxy Python setup: basic request

Start with one GET request through one proxy server. The destination should see the proxy's exit IP, not your direct IP.

```
import requests

proxies = {
    'http': 'http://123.58.199.17:8168',
    'https': 'http://123.58.199.17:8168',
}

response = requests.get('https://example.com', proxies=proxies, timeout=5)
print(response.status_code)
```

Requests returns a normal Response object. Use status\_code, text, and json() exactly as you would without a proxy.

123.58.199.17:8168 is a placeholder. Replace it with the host and port for your actual proxy server. You can find the credentials in the Froxy dashboard:

Set the 'http' and 'https' keys separately. The proxy may handle both protocols the same way, but Requests still expects both entries.

Always set timeout=5 or another explicit value. An unavailable proxy can otherwise leave the call hanging for tens of seconds, depending on the OS TCP stack.

Confirm that the proxy is active by comparing the exit IP with your direct IP:

```
response = requests.get('https://httpbin.org/ip', proxies=proxies, timeout=5)
print(response.json()) # should show the proxy IP, not yours
```

Common failures:

- 407 Proxy Authentication Required means the proxy expects credentials. See the authentication section below.
- ConnectTimeout usually means the proxy is down or isn't accepting connections on that port.
- For SSLError over an HTTP proxy, explicitly use http:// for both keys, including 'https'. This often fixes an incorrect proxy scheme.

See Common Errors and How to Fix Them for a full breakdown.

### Add a User-Agent and error handling

Add a browser-style User-Agent because Requests identifies itself as a script by default. Wrap the call in try/except so one network failure doesn't stop the entire job.

```
import requests

proxies = {
    'http': 'http://198.49.68.80:80',
    'https': 'http://198.49.68.80:80',
}

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36'
}

try:
    response = requests.get('https://example.com', proxies=proxies, headers=headers, timeout=5)
    print(response.status_code)
except requests.exceptions.RequestException as e:
    print(f"Error: {e}")
```

requests.exceptions.RequestException is the base class for ConnectionError, Timeout, TooManyRedirects, and other Requests errors. Catching it handles network and proxy failures in one place.

Many sites return simplified or blocked content when the User-Agent contains the default python-requests/x.x.x value.

If the site still blocks the request, add Accept-Language and Referer. Some anti-bot systems compare those headers with the User-Agent for consistency.

### Limitation: TLS fingerprinting (JA3/JA4)

A User-Agent changes only an HTTP header. Requests still builds its TLS handshake through urllib3 and OpenSSL, whose cipher list and extension order differ from a browser. Cloudflare, Akamai, DataDome, and similar systems can block that fingerprint before they evaluate the headers.

TLS fingerprinting is likely when the block persists after you change both the proxy and User-Agent. Typical symptoms include a bare 403 response or a JavaScript challenge.

One option is curl\_cffi:

```
from curl_cffi import requests as cf_requests

response = cf_requests.get(
    'https://example.com',
    proxies={'https': 'http://user:pass@host:port'},
    impersonate='chrome124',   # emulates a specific browser's TLS/HTTP2 fingerprint
)
print(response.status_code)
```

httpx with HTTP/2 (pip install httpx\[http2\]) is closer to a browser at the protocol level, but it doesn't imitate a browser's TLS fingerprint. If JA3/JA4 causes the block, use curl\_cffi or a headless browser instead of httpx.

### Python Requests session proxy setup

Use Session when you make many requests with the same settings. It stores the proxy configuration once and keeps a per-host pool of open TCP connections through urllib3.PoolManager. Reusing connections saves repeated TCP and TLS handshakes across dozens or hundreds of calls.

```
import requests
from requests.adapters import HTTPAdapter

session = requests.Session()
session.trust_env = False   # see the explanation below

session.proxies.update({
    'http': 'http://45.155.226.176:3128',
    'https': 'http://172.67.182.20:1080',
})

adapter = HTTPAdapter(pool_connections=10, pool_maxsize=10)  # connection pool size per host
session.mount("https://", adapter)
session.mount("http://", adapter)

response = session.get('https://example.com', timeout=5)
```

Set trust\_env = False because Session reads HTTP\_PROXY and HTTPS\_PROXY from the environment by default. Those values can override session.proxies and make your code appear broken. This behavior has been documented in Requests since 2014. Disabling environment lookup makes the session configuration predictable.

### Python Requests no proxy for one request

You may have a proxy configured globally but need one direct request, for example, to check your direct IP or reach an internal service. Pass None for the proxy addresses:

```
response = session.get('https://httpbin.org/ip', proxies={'http': None, 'https': None}, timeout=5)
```

Keys set to None are removed from the merged configuration. This overrides the session and environment settings for that call. Compare the returned IP with the proxied result to verify the behavior.

### Retries with HTTPAdapter and urllib3.Retry

For one proxy or site that occasionally returns timeouts, 502, or 503, put retries in the session transport instead of writing a manual loop:

```
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry

session = requests.Session()

retry_strategy = Retry(
    total=5,                                     # total attempts
    backoff_factor=1,                            # delay between attempts: 1s, 2s, 4s, 8s...
    status_forcelist=[429, 500, 502, 503, 504],  # HTTP status codes that trigger a retry
    allowed_methods=["GET", "POST"],
)

adapter = HTTPAdapter(max_retries=retry_strategy)
session.mount("https://", adapter)
session.mount("http://", adapter)

session.proxies.update({'http': 'http://host:port', 'https': 'http://host:port'})

response = session.get('https://example.com', timeout=5)
```

This handles intermittent failures on one proxy, much like the manual for loop and sleep later in the rotation section. Use manual rotation when you have several proxies and need to switch addresses between attempts.

### Python Requests proxy authentication

Python Requests proxy authentication uses credentials embedded in the proxy URL; Requests has no separate argument for them. You can find the username and password in the Froxy dashboard.

```
proxies = {
    'http': 'http://login:password@45.155.226.176:3128',
    'https': 'http://login:password@45.155.226.176:3128',
}
```

The user:pass@host:port format works for HTTP and SOCKS5. The proxy validates the credentials before forwarding the request, so they aren't sent to the target site.

URL-encode special characters such as @, :, and / in the username or password. Otherwise, the URL parser can misread the boundary between credentials and the host:

```
from urllib.parse import quote

user = quote("my@login")
pwd = quote("p@ss:word")
proxy_url = f"http://{user}:{pwd}@45.155.226.176:3128"
```

Don't commit proxy credentials to a public repository. Store them in environment variables or a .env file instead.

#### Use environment variables

To keep the proxy address and password out of source code, set them in the OS environment. Requests will read them without a proxies= argument in the script.

```
export HTTP_PROXY="http://45.155.226.176:80"
export HTTPS_PROXY="http://45.155.226.176:8080"
```

Windows (PowerShell):

```
$env:HTTP_PROXY="http://45.155.226.176:80"
$env:HTTPS_PROXY="http://45.155.226.176:8080"
```

Values set with export or $env: last only for the current terminal session. Add them to ~/.bashrc, ~/.zshrc, or Windows system variables if they must persist after you restart the shell or IDE.

### Python Requests SOCKS5 proxy setup

SOCKS5 forwards traffic at the transport layer. It isn't inherently faster or harder to detect than HTTP, but it avoids HTTP-specific proxy behavior. In Requests, the code changes only in the URL scheme.

```
proxies = {
    'http': 'socks5://user:pass@proxy-host:port',
    'https': 'socks5://user:pass@proxy-host:port',
}
```

```
export ALL_PROXY="socks5://45.155.226.176:3434"
```

SOCKS support comes from PySocks, installed through the requests\[socks\] extra. If you install only requests, a socks5:// URL raises an error such as MissingSchema or InvalidSchema.

Use socks5h:// instead of socks5:// to resolve DNS through the proxy. This avoids local DNS requests and can reach hostnames visible only from the proxy's network.

SOCKS5 forwards the TCP stream without parsing HTTP, so it also supports non-HTTP traffic. Requests still uses TCP only; its SOCKS integration doesn't use UDP mode.

### Rotating proxies Python Requests can use

This section covers rotating proxies Python developers can manage in code. Choose a random address or advance through the pool in round-robin order so every request doesn't hit the site from one IP.

```
import requests
import random
import time

proxy_list = [
    "http://222.252.194.204:5000",
    "http://162.223.90.130:5100",
    "http://login:password@45.155.226.176:3128",
    "http://50.217.226.41:5050",
]

def proxy_request(request_type, url, max_attempts=5, **kwargs):
    for attempt in range(max_attempts):
        proxy = random.choice(proxy_list)
        current_proxies = {"http": proxy, "https": proxy}
        try:
            response = requests.request(request_type, url, proxies=current_proxies, timeout=5, **kwargs)
            print(f"Proxy used: {proxy}")
            return response
        except requests.exceptions.RequestException as e:
            print(f"Attempt {attempt + 1} failed via {proxy}: {e}")
            time.sleep(1)
    raise RuntimeError("All proxy attempts failed")

response = proxy_request('GET', 'https://example.com')
```

Use itertools.cycle for round-robin selection:

```
from itertools import cycle

proxy_cycle = cycle(proxy_list)

def next_proxy():
    return next(proxy_cycle)
```

For a large or unstable pool, provider-managed rotation is simpler. Requests connects to one fixed endpoint while the provider changes the exit IP. In Froxy, set the rotation interval in the dashboard; the connection string stays the same.

###### Residential Proxies

Perfect proxies for accessing valuable data from around the world.

[Try With Trial](https://froxy.com/en/residential-proxies) $1.99, 100Mb

## Common Errors and How to Fix Them

![Common Errors and How to Fix Them](https://blog.froxy.com/hs-fs/hubfs/blog/python-requests-proxy/troubleshooting.png?width=1548&height=544&name=troubleshooting.png)

All Requests network errors inherit from requests.exceptions.RequestException, so one catch block can handle them. Log the specific subclass because the fix depends on the failure.

| Code/error | Cause | What to do |
| --- | --- | --- |
| 407 Proxy Authentication Required | The proxy received no credentials or rejected them | Add user:pass@ to the proxy URL and URL-encode special characters |
| 401 Unauthorized | Authentication failed on the target site, not the proxy | Check the target site's credentials |
| 403 Forbidden | The proxy blocks your IP, or the target blocks the proxy | Check the provider's IP allowlist and whether the target is permitted |
| Timeout / ProxyError | The proxy is down, overloaded, or waiting on the target | Always set timeout= and fall back to the next proxy in the IP pool |
| SSLError | The proxy replaces the certificate, or HTTPS isn't using CONNECT | Use http:// for both keys; in tests, pass your CA with verify='/path/ca.pem' |

verify=False disables certificate validation and may suppress SSLError, but it also removes protection against traffic interception. Use it only in a controlled test environment. In production, pass the proxy CA certificate path to verify= instead.

## Best Practices and Security Considerations

![Best Practices and Security Considerations](https://blog.froxy.com/hs-fs/hubfs/blog/python-requests-proxy/tips.png?width=1548&height=545&name=tips.png)

A proxy alone rarely handles modern bot detection. Cloudflare, Akamai, and similar systems evaluate the IP, request behavior, and client fingerprint. Before scraping, check the site's Terms of Service and applicable law; public data is generally lower-risk but isn't automatically permitted.

- **Randomized delays.** Avoid perfectly even request intervals; add bounded jitter between calls.
- **Header rotation.** Keep User-Agent and Accept-Language internally consistent rather than changing each value independently.
- **TLS fingerprint (JA3/JA4).** Requests exposes a non-browser fingerprint. For targets that require a browser client, use Playwright, Selenium, or a library such as curl\_cffi, and expect site-specific limits.
- **Honeypots.** Don't follow hidden links that a normal browser user couldn't reach.
- **CAPTCHA handling.** If you have authorization to automate the workflow, treat CAPTCHA challenges as a signal to slow down or switch to an approved integration.
- **Official APIs.** Use a documented API when it provides the data you need. It is usually more stable than scraping and gives you clearer rate limits.
- **Proxy quality.** Free public proxies are useful only for a quick connectivity test. Datacenter proxies usually offer lower latency when the target doesn't filter hosting-network IPs. Residential and mobile proxies better match consumer networks but tend to be slower and remain detectable through behavior or fingerprints.

## Conclusion and Recommendations

![Python Requests Proxy](https://blog.froxy.com/hs-fs/hubfs/blog/python-requests-proxy/conclusion.png?width=1548&height=634&name=conclusion.png)

A Python Requests proxy setup is enough for basic web scraping, but scale depends on retries, rotation, and IP quality. Choose datacenter, residential, mobile, or static residential (ISP) proxies based on the target's controls, latency requirements, and session model.

Froxy provides a pool of 120+ million IPs across 200+ locations, with city- and ISP-level targeting and automatic rotation. The trial provides 3 days of access for $1.99.

## FAQ

### How do you send a request through a proxy in Python Requests?

Pass a proxies dictionary with separate settings for HTTP and HTTPS requests:

```
import requests

proxies = {
    'http': 'http://host:port',
    'https': 'http://host:port',
}

response = requests.get(
    'https://example.com',
    proxies=proxies,
    timeout=(5, 20),
)
```

The dictionary key matches the target URL protocol. The https key may still point to a value beginning with http:// because an HTTPS request uses CONNECT through the HTTP proxy.

In timeout=(5, 20), the first value is the connection timeout and the second is the read timeout. The tuple isn't a total request-duration limit.

### How does Python Requests proxy authentication work?

Put the credentials in the proxy URL:

```
http://user:password@host:port
```

If the username or password contains @, :, /, #, %, or another special character, encode each value with urllib.parse.quote and safe=''.

Don't store a URL with credentials directly in source code or version control.

### How do HTTP, HTTPS, and SOCKS5 proxies differ?

An HTTP proxy accepts HTTP requests and forwards them to the target server. For HTTPS, it usually creates a TCP tunnel with CONNECT, and the client establishes TLS with the site inside that tunnel.

An HTTPS proxy also uses TLS between the client and the proxy server. This protects the connection parameters from local network interception.

SOCKS5 forwards TCP traffic at the transport layer without parsing HTTP. You can use it for HTTP, HTTPS, and other TCP-based protocols.

### How do you use SOCKS5 with Requests?

Install the extra dependencies with python -m pip install "requests\[socks\]".

Use socks5:// or socks5h:// in the proxy URL. The first resolves DNS on the client; the second resolves it through the proxy.

Without the extra dependencies, Requests raises InvalidSchema.

### How do you configure a proxy with environment variables?

Requests supports HTTP\_PROXY, HTTPS\_PROXY, ALL\_PROXY, and NO\_PROXY. Uppercase and lowercase variable names both work.

Set the variables with export on Linux and macOS or $env: in PowerShell. You then don't need to pass proxies with every request.

A proxies argument passed directly to the request method takes precedence over environment variables. However, environment settings can override values in session.proxies.

### How do you exclude specific addresses from proxying?

Use NO\_PROXY to list domains and IP addresses that Requests should contact directly. Separate entries with commas.

For example, localhost,127.0.0.1,.example.com excludes local addresses and all example.com subdomains.

### How do you disable the proxy for one request?

For a standard configuration, pass {'http': None, 'https': None, 'all': None}. This method doesn't account for separate host-specific rules.

A temporary session that ignores environment settings is more predictable:

```
import requests

with requests.Session() as session:
    session.trust_env = False
    response = session.get(url, timeout=(5, 20))
```

trust\_env = False disables proxies and several other settings inherited from the environment.

### Why does the site still see your direct IP?

Common causes include:

- The proxy is configured only for HTTP, but the request uses HTTPS
- The proxy URL has no scheme
- The host, port, username, or password is wrong
- Special characters in the credentials aren't encoded
- Environment settings override session.proxies
- DNS requests resolve locally when you use socks5://
- The proxy forwards the original IP in service headers
- Another library sends part of the traffic without proxy settings

An invalid or unsupported scheme usually raises an exception such as InvalidSchema. Requests doesn't silently ignore it.

Check the exit IP with a request to https://httpbin.org/ip or another IP-check endpoint.

### What does 407 Proxy Authentication Required mean?

A 407 response means the proxy requires authentication or rejected the supplied credentials.

Check the URL format, username, password, special-character encoding, and the authentication method the proxy supports.

401 Unauthorized applies to authentication on the target site, not the proxy.

### How do you configure rotating proxies Python Requests can use?

You have two main options:

- The rotating proxies Python code selects can come from a local list. Choose the next or a random address for each request, then retry network failures through another address.
- Provider-managed rotating proxies Python scripts access through one gateway simplify pool management. The connection string stays fixed while the provider changes the exit IP.

For self-managed rotation, catch ProxyError, ConnectTimeout, and ReadTimeout, and cap the retry count. Provider-managed rotation is usually easier with a large IP pool.

### Does a proxy slow down Requests?

Yes. A proxy adds another network hop. HTTPS also requires a tunnel and a TLS handshake.

Latency depends on the proxy's location, load, and type. Residential and mobile proxies are usually slower than datacenter proxies.

Use Session for a series of requests:

```
with requests.Session() as session:
    session.trust_env = False
    session.proxies.update(proxies)
    response = session.get(url, timeout=(5, 20))
```

A session reuses connections and reduces repeated TCP and TLS handshakes. The benefit is most visible across several requests to one host through one proxy.

###### Residential Proxies

Access the global proxy infrastructure and collect any data without being blocked.

[Try with Trial](https://froxy.com/en/residential-proxies) $1.99, 100Mb

### Get notified on new Froxy features and updates

Be the first to know about new Froxy features to stay up-to-date with the digital marketplace and receive news about new Froxy features.

## Related articles

![How to Use pip with a Proxy: Complete Guide for Developers](https://blog.froxy.com/hubfs/blog/how-to-use-pip-with-a-proxy/how-to-use-pip-with-a-proxy.png)

Proxies

### How to Use pip with a Proxy: Complete Guide for Developers

Learn how to configure pip to work behind a proxy server. This step-by-step guide covers setup, authentication, environment variables, and...

Team Froxy 12 Jun 2025 8 min read 

<https://blog.froxy.com/en/how-to-use-pip-with-a-proxy?hsLang=en>

![Anonymous Proxy Detected: What to Do with This Error in 2026](https://blog.froxy.com/hubfs/blog/anonymous-proxy-detected/anonymous-proxy-detected.png)

Proxies

### Anonymous Proxy Detected: What to Do with This Error in 2026

Encountering the Anonymous Proxy Detected error? Learn what it means and why it's happening, and discover steps to bypass it and regain access to...

Team Froxy 3 Oct 2024 3 min read 

<https://blog.froxy.com/en/anonymous-proxy-detected?hsLang=en>

Best-in-class Residential & Mobile proxies.

<https://t.me/+UIeMe_c8S1U4ZGE6> [mailto:support@froxy.com](mailto:support@froxy.com) 

[![TrustPilot](https://blog.froxy.com/hs-fs/hubfs/trustpilot-2.png?height=22&name=trustpilot-2.png) ![4.7](https://cdn.trustpilot.net/brand-assets/4.1.0/stars/stars-4.5.svg) 4.7](https://www.trustpilot.com/review/froxy.com)

Products [Residential Proxies](https://froxy.com/en/residential-proxies) [Mobile Proxies](https://froxy.com/en/mobile-proxies) [Datacenter Proxies](https://froxy.com/en/datacenter-proxies)

Use cases [Price Monitoring](https://froxy.com/en/use-cases/price-monitoring) [Market Research](https://froxy.com/en/use-cases/market-research) [Social Listening](https://froxy.com/en/use-cases/social-listening) [Web Scraping](https://froxy.com/en/use-cases/web-scraping) [SEO Monitoring](https://froxy.com/en/use-cases/seo-monitoring)

Company [Prices](https://froxy.com/en/get-started) [About Us](https://froxy.com/en/about) [Contact Sales](https://froxy.com/en/support) [Support](https://froxy.com/en/support)

Resources [Integrations](https://froxy.com/en/integrations) [Locations](https://froxy.com/en/locations) [Affiliate](https://froxy.com/en/referral-system) [Help](https://help.froxy.com/en?hsLang=en) [Payment Methods](https://froxy.com/en/payment-methods)

Copyright © 2021 – 2026. Wergames OÜ. All rights reserved. Harju maakond, Tallinn, Kesklinna linnaosa, Endla tn 4, 10142

[Terms of Use](https://froxy.com/en/terms-of-use) [Privacy Policy](https://froxy.com/en/privacy-policy) [Cookie Policy](https://froxy.com/en/cookie-policy) [Refund & Cancellation Policy](https://froxy.com/en/refund-policy) [SLA](https://froxy.com/en/service-level-agreement)

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Team Froxy",
    "url" : "https://blog.froxy.com/en/author/team-froxy"
  },
  "dateModified" : "2026-09-14T10:31:56.435Z",
  "datePublished" : "2025-05-15T09:00:00.000Z",
  "headline" : "Python Requests Proxy: Setup, Rotation, and SOCKS5",
  "image" : [ "https://blog.froxy.com/hubfs/blog/python-requests-proxy/python-requests-proxy.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.froxy.com/en/python-requests-proxy",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.froxy.com/hubfs/froxy-logo.svg"
    },
    "name" : "Froxy"
  }
}
```