# requests-proxy-rotation
A wrapped version of requests. Help bypassing limitation of API by automatic rotating proxy.
## How to install
```bash
pip install requests_proxy_rotation
```
or
```bash
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
```python
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.
```python
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", ...)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "requests-proxy-rotation",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "python library requests proxy rotation",
"author": "phannt",
"author_email": "phan123123@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ee/9d/9b1f8597d6df8d5acb13b43b771914ea5f6ea55c749bcd25b78556175822/requests-proxy-rotation-1.0.1.tar.gz",
"platform": null,
"description": "# requests-proxy-rotation\nA wrapped version of requests. Help bypassing limitation of API by automatic rotating proxy.\n\n## How to install\n```bash\npip install requests_proxy_rotation\n```\nor\n```bash\npip install git+https://github.com/phan123123/requests_proxy_rotation\n```\n\n## How to use\n### Limit based mode\nRequests will be sent with proxies one by one with a limit number\n```python\nfrom requests_proxy_rotation import RequestsWrapper\n\nproxylist = [\"socks5://123.123.123.123:8080\",\"socks4://1.2.3.4:1234\"]\nverify_endpoint = \"http://example.com\" # using this endpoint to check proxy is alive or not\nrequests = RequestsWrapper(proxylist=proxy_list,verify_endpoint=verify_endpoint, mode = RequestsWrapper.LIMIT_BASED)\n\nrequests.add_rotator(\"domain_01\",limit_times = 5) # domain_01 API with limit 5 times for each IP.\nresponse = requests.get(\"http://domain_01/get_endpoint\")\nresponse = requests.post(\"http://domain_01/post_endpoint\", data=\"test\")\nresponse = requests.request(\"method\",\"http://domain_01\", ...)\n```\n### Time based mode\nRequests will be sent a limit of number with each limit times during a number of unit time.\n```python\nfrom requests_proxy_rotation import RequestsWrapper\n\nproxylist = [\"socks5://123.123.123.123:8080\",\"socks4://1.2.3.4:1234\"]\nverify_endpoint = \"http://example.com\"\nrequests = RequestsWrapper(proxylist=proxy_list,verify_endpoint=verify_endpoint, mode = RequestsWrapper.TIME_BASED)\n\nrequests.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.\nresponse = requests.get(\"http://domain_01/get_endpoint\")\nresponse = requests.post(\"http://domain_01/post_endpoint\", data=\"test\")\nresponse = requests.request(\"method\",\"http://domain_01\", ...)\n```\n\n\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "A wrapped version of requests. Help bypassing limitation of API by automatic rotating proxy",
"version": "1.0.1",
"project_urls": null,
"split_keywords": [
"python",
"library",
"requests",
"proxy",
"rotation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "15374163becec451160ca097e489caf7e21fc92da4fb722826678dba7279f1ff",
"md5": "7ed0d3316c811d37257d5ca595f221dd",
"sha256": "175002db315ffb2cc5a2f7c5c16b1ee32c629786d86a4209417067efc687730f"
},
"downloads": -1,
"filename": "requests_proxy_rotation-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7ed0d3316c811d37257d5ca595f221dd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 8640,
"upload_time": "2024-09-24T17:16:30",
"upload_time_iso_8601": "2024-09-24T17:16:30.113271Z",
"url": "https://files.pythonhosted.org/packages/15/37/4163becec451160ca097e489caf7e21fc92da4fb722826678dba7279f1ff/requests_proxy_rotation-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ee9d9b1f8597d6df8d5acb13b43b771914ea5f6ea55c749bcd25b78556175822",
"md5": "c77125b36b8bb78c8adbb2bea6fcd6c7",
"sha256": "9262a475bf383d2746b7573da69cf7b6e5c00466608c02cec6be08769aaaf020"
},
"downloads": -1,
"filename": "requests-proxy-rotation-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "c77125b36b8bb78c8adbb2bea6fcd6c7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 8054,
"upload_time": "2024-09-24T17:16:33",
"upload_time_iso_8601": "2024-09-24T17:16:33.212270Z",
"url": "https://files.pythonhosted.org/packages/ee/9d/9b1f8597d6df8d5acb13b43b771914ea5f6ea55c749bcd25b78556175822/requests-proxy-rotation-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-24 17:16:33",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "requests-proxy-rotation"
}