Quick Start
Prerequisites
- Docker Engine
- Python ^3.8
Install with pip
pip install requests-whaor
Install with Poetry
poetry add requests-whaor
Use with the Requests library
from requests_whaor import RequestsWhaor
import requests
URL = "http://jsonip.com/"
with RequestsWhaor(onion_count=5) as requests_whaor:
for _ in range(10):
result = requests.get(URL, proxies=requests_whaor.rotating_proxy)
print(result.text)
Use with the requests_whaor's internal get method which retries on failure
from requests_whaor import RequestsWhaor
URL = "http://jsonip.com/"
with RequestsWhaor(onion_count=5, max_retries=10) as requests_whaor:
for _ in range(10):
result = requests_whaor.get(URL)
print(result.text)
Note
- RequestsWhaor's internal .get() method will retry requests on ProxyError, Timeout, ConnectionError and bad response codes.
- On each retry the request will routed through a new ip address.