How to use a proxy with Python Requests
This guide walks you through integrating HypeProxies with Python Requests library to bypass IP restrictions, overcome geo-targeting, and manage rate limiting in your web scraping workflows.
$1 one-time verification. Unlock your trial today.
Speed
Success
Consistency
Reliability
Flexibility
Prerequisites
Before we dive in, make sure your environment is set up and you have your proxy credentials ready.
1. Python and the Requests library

First, ensure you have Python 3.9 or newer installed. You'll also need the Requests library, which is the standard for making HTTP requests in Python. If you don't have it installed, add it to your project with:
2. Your HypeProxies credentials
Next, you'll need an active HypeProxies subscription to get your proxy list.
Step 1 (access your dashboard) – log into your HypeProxies dashboard. If you're new, you can request a free trial to get started.
Step 2 (find your active plan) – navigate to your active services. If you don't have a plan yet, explore our full range of high-speed proxy solutions to find the perfect fit for your project.
Step 3 (locate and copy your proxy list) – in your service details, you'll find your proxy list formatted as IP:PORT:USERNAME:PASSWORD.

Each line contains a unique proxy, but your username and password are the same for all of them. Copy these proxies as you'll need them later in the tutorial.
With the setup complete, let's make our first request.
Making a single request with a proxy
Integrating a proxy with Requests is straightforward. The library accepts a proxies dictionary that maps the protocol (http or https) to your formatted proxy URL.
Let's start by using just the first proxy from your list to make a request to https://ipapi.co/json/, a simple service that returns your public IP address.
When you run this script, the output will show the IP address of your HypeProxies, confirming that your request was successfully routed.

This simple method is great for one-off tasks, but for more complex projects, you'll need a more efficient approach.
Using sessions for better performance
When your script needs to make multiple requests, creating a new connection for each one is inefficient. A much better approach is to use a requests.Session object. Sessions reuse the underlying TCP connection, which provides a significant speed boost and reduces overhead.
A Session object also persists configurations, like proxies and headers, across all requests made with it.
Using sessions is a critical best practice for any serious scraping project. Now, let's learn how to manage an entire list of proxies.
Managing your proxy pool with client-side rotation
HypeProxies provides static ISP proxies, which means you get a consistent IP that never changes. While perfect for tasks needing a stable identity, for large-scale web scraping, you can't just hammer a server from a single IP. That's a fast track to getting blocked.
The solution is client-side rotation. It’s on you to intelligently distribute requests across your entire proxy pool. This tactic spreads your digital footprint, making your scraper look less like a bot and more like organic traffic. Let's walk through 2 classic rotation strategies: round-robin and random.
First, create a proxies.txt file:
Here's how you can load your proxy list from the proxies.txt file and implement the rotation strategies:
This rotation pattern is fundamental for many scraping use cases, from market research to social media account management.
When you run the code, you'll see a clear difference in how the IPs are used. The round-robin approach cycles through your list sequentially, while the random approach might reuse an IP before it has used all the others.

This code gives you a powerful template for distributing your requests, significantly reducing the chance of being rate-limited.
Building a resilient scraper with automatic retries
In real scraping scenarios, network requests can fail for many reasons: a temporary server error, a network glitch, or a proxy timing out. A robust script shouldn't crash on the first failure. By combining requests.Session with a retry strategy, you can build a much more resilient scraper.
This example creates a session that'll automatically retry failed requests with an exponential backoff delay, which is a respectful way to handle temporary server issues.
This setup gives your scrapers a professional level of reliability, ensuring that temporary issues don't derail your entire process.
Troubleshooting common issues
Even with a perfect setup, you might run into issues. Here are some common problems and their solutions.
Problem – ProxyError: Max retries exceeded or 407 Proxy Authentication Required
This error almost always points to an authentication failure. Double-check that the username and password in your script perfectly match the credentials in your HypeProxies dashboard.
Problem – requests are consistently timing out
This suggests a connectivity issue. First, check if the proxy is online using our free online proxy checker. If the proxy is active, the issue might be a firewall on your local network blocking the connection. Try increasing the timeout value in your request (e.g., timeout=30).
Problem – I'm still getting blocked, even with a proxy
Websites use advanced techniques to detect bots. Simply hiding your IP isn't always enough. Ensure you're also rotating your User-Agent header, adding random delays between requests, and respecting the site's robots.txt file. For complex targets, explore our other integration guides for tools that can manage browser fingerprints.
Problem – some of my proxies are slow or failing
While we guarantee 99.9% uptime, individual proxies can sometimes face temporary issues. You can use our proxy checker tool to test your list in bulk. If you find a consistently failing proxy, contact our support team for a replacement.
Getting support
If you run into any trouble, our team is here to help.
For technical issues, open a support ticket for 24/7 assistance.
For community help, join our Discord server to connect with other developers.
Share on
$1 one-time verification. Unlock your trial today.
Stay in the loop
Subscribe to our newsletter for the latest updates, product news, and more.
No spam. Unsubscribe at anytime.
Fast static residential IPs