Run an API on your local machine that reroutes traffic through rotating proxies. Useful for pyppeteer proxy rotation.
Project description
async-rotating-proxy
Run an API on your local machine that reroutes traffic through rotating proxies.
- Excellent for scaling your web scraping
- Designed for page-by-page dynamic proxy switching with pyppeteer
Installation
pip install async_rotating_proxy
Usage
from async_rotating_proxy import ProxyAPI
import pyppeteer
proxies = [
ip:port,
ip:port,
ip:port
]
with ProxyAPI(proxies) as api:
url = api.format_url("http://checkip.dyndns.org")
browser = await pyppeteer.launch()
page = await browser.newPage()
await page.goto(url)
Purpose
The article referenced below sums it up pretty well: "The chrome browser does not support fain-grained proxy configuration out of the box. Therefore, the following use cases are not possible when using puppeteer in combination with Google Chrome:
Using different proxies for different tabs/windows
Switching proxies without restarting the browser
This is a bit annoying, because restarting the entire browser is an expensive operation in terms of computational resources. The chrome restart takes up to two seconds (depending on the system). We ideally want to switch proxies whenever the need arises without restarting the entire chrome process. This is a common requirement when scraping websites in scale."
Reference
https://incolumitas.com/2020/12/20/dynamically-changing-puppeteer-proxies/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file async_rotating_proxy-0.0.6.tar.gz
.
File metadata
- Download URL: async_rotating_proxy-0.0.6.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30dcd391ce4a884a53321352a8e8258126432019ab54dc82bde0a3b6b49ef6de |
|
MD5 | beb1810c5d4b0109783c73777e483a2a |
|
BLAKE2b-256 | 16199b3d92bd304e4a4b1815d143708bd76d3767068103b8019c0319a36930a0 |
File details
Details for the file async_rotating_proxy-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: async_rotating_proxy-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3f14cfa61c08b37adce84d1989d9780891d938e2b4d47ce881503551938a961 |
|
MD5 | 64c171c990dc134c5f19fc39b454e21b |
|
BLAKE2b-256 | e8742c2bfa1ed152f37616540be567b1b935f4cf8a854bc78e24e07239e827f4 |