A wrapped version of requests. Help bypassing limitation of API by automatic rotating proxy
Project description
requests-proxy-rotation
A wrapped version of requests. Help bypassing limitation of API by automatic rotating proxy.
How to install
pip install requests_proxy_rotation
or
pip install git+https://github.com/phan123123/requests_proxy_rotation
How to use
Limit based mode
Requests will be sent with proxies one by one with a limit number
from requests_proxy_rotation import RequestsWrapper
proxylist = ["socks5://123.123.123.123:8080","socks4://1.2.3.4:1234"]
verify_endpoint = "http://example.com" # using this endpoint to check proxy is alive or not
requests = RequestsWrapper(proxylist=proxy_list,verify_endpoint=verify_endpoint, mode = RequestsWrapper.LIMIT_BASED)
requests.add_rotator("domain_01",limit_times = 5) # domain_01 API with limit 5 times for each IP.
response = requests.get("http://domain_01/get_endpoint")
response = requests.post("http://domain_01/post_endpoint", data="test")
response = requests.request("method","http://domain_01", ...)
Time based mode
Requests will be sent a limit of number with each limit times during a number of unit time.
from requests_proxy_rotation import RequestsWrapper
proxylist = ["socks5://123.123.123.123:8080","socks4://1.2.3.4:1234"]
verify_endpoint = "http://example.com"
requests = RequestsWrapper(proxylist=proxy_list,verify_endpoint=verify_endpoint, mode = RequestsWrapper.LIMIT_BASED)
requests.add_rotator("domain_01",limit_times = 5, time_rate=(2,RequestsWrapper.UNIT_MIN)) # domain_01 API with limit 5 times for each IP in 2 minutes.
response = requests.get("http://domain_01/get_endpoint")
response = requests.post("http://domain_01/post_endpoint", data="test")
response = requests.request("method","http://domain_01", ...)
Project details
Release history Release notifications | RSS feed
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
Close
Hashes for requests-proxy-rotation-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fd56fba98ec1fc83cce7795b1a315cad1aa628c13e0f3be4570476356b5a659 |
|
MD5 | cb7841094e40d09172e2e8014b8c61b6 |
|
BLAKE2b-256 | 33a9849f70cf8b3df15128d25bd1e41bbe48a966e00b9097166b2ed509708f05 |
Close
Hashes for requests_proxy_rotation-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d36dc2994e3491ab1bb1ecb076592d4c571b84e77ceb9c47dfe39ccceb17f698 |
|
MD5 | af459279e47bce26c3fa83c62559d2e5 |
|
BLAKE2b-256 | 77ce7191eee9b1bcb22425fd0085e798ae6edc0153f545ffe18bb7d040e0abf4 |