Each request POST operation can be configured to use network proxies
HTTP/S Proxies
from requests import post
proxies = {
'http': 'http://192.168.0.128:3128',
'https': 'http://192.168.0.127:1080',
}
foo = requests.post('http://httpbin.org/post', proxies=proxies)
HTTP Basic Authentication can be provided in this manner:
proxies = {'http': 'http://user:[email protected]:312'}
foo = requests.post('http://httpbin.org/post', proxies=proxies)
SOCKS Proxies
The use of socks proxies requires 3rd party dependencies requests[socks]
, once installed socks proxies are used in a very similar way to HTTPBasicAuth:
proxies = {
'http': 'socks5://user:pass@host:port',
'https': 'socks5://user:pass@host:port'
}
foo = requests.post('http://httpbin.org/post', proxies=proxies)