Requests Proxy Adapter¶
Set of Proxy Transport Adapters for Requests.
- Free software: MIT license
- Documentation: https://requests-proxy-adapter.readthedocs.io.
Features¶
- PrivoxyAdapter – The transport adapter for Requests to use Privoxy proxy-server with retries when backend errors occurred.
- RetryPrivoxyAdapter – The transport adapter for Requests to use Privoxy proxy-server with retries when backend errors occurred and retries if errors occured on target site by urllib3.util.retry module.
Usage¶
The simple exmaple of usage adapters (Privoxy run locally on 8118 port):
>>> import requests
>>> from requests_proxy_adapter import PrivoxyAdapter
>>> r = requests.get('http://httpbin.org/ip')
>>> public_ip = r.json()['origin']
>>> s = requests.Session()
>>> s.mount('http://', PrivoxyAdapter('http://localhost:8118'))
>>> r = s.get('http://httpbin.org/ip')
>>> assert r.status_code == 200
>>> anon_ip = r.json()['origin']
>>> assert anon_ip != public_ip
See also Requests Transport Adapters documentation.
Authors¶
Alexey Shevchenko <otetz@me.com>