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.1.0.tar.gz (8.0 kB view details)

Uploaded Source

File details

Details for the file requests_proxy_rotation-1.1.0.tar.gz.

File metadata

  • Download URL: requests_proxy_rotation-1.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for requests_proxy_rotation-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1d96fe566d5f1d9740a32fcc8965d4a7f63b3e4b9a1ea635062298d5493f1cf0
MD5 ddde9fee9c12543cd88ae5dd83dc079e
BLAKE2b-256 58e08ecafc2485c1ff4058a656f555551be744c24f1de12205712649dee36eb5

See more details on using hashes here.

Supported by

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