Skip to main content

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.TIME_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requests-proxy-rotation-1.0.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

requests_proxy_rotation-1.0.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file requests-proxy-rotation-1.0.1.tar.gz.

File metadata

File hashes

Hashes for requests-proxy-rotation-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9262a475bf383d2746b7573da69cf7b6e5c00466608c02cec6be08769aaaf020
MD5 c77125b36b8bb78c8adbb2bea6fcd6c7
BLAKE2b-256 ee9d9b1f8597d6df8d5acb13b43b771914ea5f6ea55c749bcd25b78556175822

See more details on using hashes here.

File details

Details for the file requests_proxy_rotation-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for requests_proxy_rotation-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 175002db315ffb2cc5a2f7c5c16b1ee32c629786d86a4209417067efc687730f
MD5 7ed0d3316c811d37257d5ca595f221dd
BLAKE2b-256 15374163becec451160ca097e489caf7e21fc92da4fb722826678dba7279f1ff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page