Skip to main content
Piloterr
Back to blog
March 6, 2024

IP-Based Restrictions with Requests-IP-Rotator

In the digital age, accessing data across the web has become paramount for businesses and individuals alike. However, web scraping and brute forcing often hit a significant roadblock: IP-based rate limits. Enter Requests-IP-Rotator, a Python library that leverages AWS API Gateway's vast IP pool to circumvent these restrictions, opening a realm of possibilities for data enthusiasts and cybersecurity experts.

Piloterr handles proxy rotation automatically via datacenter proxies: see our proxy glossary.

What is Requests-IP-Rotator?

Requests-IP-Rotator is an ingenious solution that uses AWS API Gateway as a proxy to generate a seemingly infinite number of IPs for web scraping and brute-forcing endeavors. This tool can randomize requests' IP addresses, helping users bypass IP-based rate-limits on various sites and services effectively.

How Does It Work?

AWS API Gateway acts as a middleman, sending requests from any available IP within AWS's extensive infrastructure. This variability almost guarantees a different IP for each request. While AWS sends specific headers with each request (like "X-Amzn-Trace-Id"), making them identifiable, the vast pool of IPs offers a significant advantage in anonymizing requests.

Getting Started with Requests-IP-Rotator

Installation

Requests-IP-Rotator is available on PyPI and can be installed using pip:

Bash
pip3 install requests-ip-rotator

Simple Usage

To use Requests-IP-Rotator, initialize an ApiGateway object with the target site, start the gateway, and mount it to a requests.Session:

Python
import requests
from requests_ip_rotator import ApiGateway

gateway = ApiGateway("https://site.com")
gateway.start()

session = requests.Session()
session.mount("https://site.com", gateway)

response = session.get("https://site.com/index.php", params={"theme": "light"})
print(response.status_code)

gateway.shutdown()

Key Features

  • Stealthy Browsing : It employs various techniques to hide its bot nature from websites, enhancing stealth.**
  • Captcha Solving : Requests-IP-Rotator can solve a wide variety of Captchas using AI and other methods, reducing the need for Captcha solving APIs.
  • Cost-Effective : The first million requests per region are free with AWS API Gateway, making it cost-effective for most use cases.

AWS Authentication

It is recommended to setup authentication via environment variables. With awscli, you can run aws configure to do this, or alternatively, you can simply set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY variables yourself.

Conclusion

Requests-IP-Rotator stands as a testament to the innovative use of cloud services to overcome web scraping and brute-forcing challenges. By harnessing AWS's infrastructure, it provides an invaluable tool for data extraction and cybersecurity practices, ensuring access to web resources is as unrestricted and efficient as possible.

More to read

Guides and news about web scraping, proxies, and data extraction.

Open Source & Hot

Deploy n8n with AI Modules on Render for Free

Practical guide to deploy n8n with AI modules on Render. Learn how to set up your instance for FREE, keep your server active, and use advanced automation features with AI.

Josselin Liebe
Josselin Liebe
Read
Open Source & Hot

NoDriver: Open Source Advanced Browser Control

NoDriver is a groundbreaking web automation library that offers advanced features for evading detection by web application firewalls (WAFs) and significantly improving performance.

Josselin Liebe
Josselin Liebe
Read

Botright : Open-Source Automation Framework

Botright, an innovative, undetectable, and open-source automation framework designed to revolutionize web automation tasks. Developed by Vinyzu and built on Playwright's robust foundations.

Josselin Liebe
Josselin Liebe
Read

Ready to get started?

Your web scraping API is one click away. Start with +500 credits, no infrastructure to set up, no proxies to manage, and no credit card required.

  • +500 credits
  • No credit card required
  • All endpoints included