async-rotating-proxy-0.0.1
توضیحات
Run an API on your local machine that reroutes traffic through rotating proxies. Useful for pyppeteer proxy rotation.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | async-rotating-proxy-0.0.1 |
| نام | async-rotating-proxy |
| نسخه کتابخانه | 0.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Greg Bizup <g.bizup@gmail.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/async-rotating-proxy/ |
| مجوز | - |
# async-rotating-proxy
Run an API on your local machine that reroutes traffic through rotating proxies.
- Useful with pyppeteer and selenium
- Built on FastAPI and aiohttp
- Switch proxies on every request
## Installation
`pip install async_rotating_proxy`
## Usage
Usage is simple. Just start the API, format the URL, and send requests.
```
# Instantiating ProxyAPI class launches the API on localhost
proxy_api = ProxyAPI([proxy1:port, proxy2:port, proxy3:port],
proxy_username='my_auth_cred',
proxy_password='my_auth_cred',
port=9001)
# Encode and format the URL to get
# This prepends the localhost address and encodes the URL
url = 'http://checkip.dyndns.org/'
formatted_url = proxy_api.format_url(url)
# Visit the formatted URL using preferred method
# I use pyppeteer in this example
browser = await pyppeteer.launch()
page = await browser.newPage()
await page.goto(formatted_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/
نیازمندی
| مقدار | نام |
|---|---|
| - | aiohttp>=3.8.4 |
| - | fastapi>=0.95.1 |
| - | pyppeteer>=1.0.2 |
| - | uvicorn>=0.21.1 |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >3.10 | Python |
نحوه نصب
نصب پکیج whl async-rotating-proxy-0.0.1:
pip install async-rotating-proxy-0.0.1.whl
نصب پکیج tar.gz async-rotating-proxy-0.0.1:
pip install async-rotating-proxy-0.0.1.tar.gz