The proxies syntax is {"protocol":"ip:port", ...}. With it you can specify different (or the same) proxie(s) for requests using http, https, and ftp protocols:
http_proxy = "<http://10.10.1.10:3128>"
https_proxy = "<https://10.10.1.11:1080>"
ftp_proxy = "<ftp://10.10.1.10:3128>"
proxyDict = {
"http" : http_proxy,
"https" : https_proxy,
"ftp" : ftp_proxy
}
**r = requests.get(url, headers=headers, proxies=proxyDict)**
Alternatively, you can assign proxies directly as an argument:
proxies = {'<http://10.20.1.128>': '<http://10.10.1.10:5323>'}
You can configure proxies once for an entire Session:
proxies = {
'http': '<http://10.10.1.10:3128>',
'https': '<http://10.10.1.10:1080>',
}
session = requests.Session()
session.proxies.update(proxies)
session.get('<http://example.org>')
To use HTTP Basic Auth with your proxy, use the http://user:password@host/
syntax in any of the above configuration entries:
proxies = {'http': '<http://user:[email protected]:3128/>'}
To use proxies to connect to burpsuite:
proxies = {'http': '<http://127.0.0.1:8080>', 'https': '<http://127.0.0.1:8080>'}
# so that pages would go to burp in I wanted to debug it.