Reputation: 1168
I'm using the following code to set the proxy for the HTMLSession
, get()
method. Still, it uses my IP instead of the proxy IP.
proxy string format:
http://username:password@ip:port
r = session.get('https://whatismyipaddress.com/', proxies={'http': proxy})
r.html.find('p.ip-address')[0].text
above print the following which is my current IP address.
'IPv4:? The most common IP version is assigned by ISPs. 175.157.?.?'
Upvotes: 1
Views: 2545
Reputation: 564
You need to add 'https' in proxies:
proxy = 'http://username:password@ip:port'
r = session.get('https://whatismyipaddress.com/', proxies={'http': proxy, 'https': proxy})
Upvotes: 2