Reputation: 123
I am trying to access a proxy, that I have ping multiple times and is online, to do a search.
import requests
import re
s = requests.Session()
s.proxies = {'http': 'http://11.22.33.4455'}
r = s.get('https://www.iplocation.net/find-ip-address')
data = r.text
regex = r"1.2.3.45" # Proxy IP
regex2 = r"6.7.8.99" # My IP
matches = re.findall(regex, data)
matches2 = re.findall(regex2, data)
print(matches)
print(matches2) # Always prints out my current IP and not my proxy
This is my code. I use regular expressions to search the html code for mentions of the IP and it always only returns my current IP. I tried different websites that tell me my IP and everyone of them returns my current IP and not my proxy. Any suggestion on what I am doing wrong.
Upvotes: 6
Views: 3583
Reputation: 317
Your proxy is http while your request address is a https. You need to have another proxy for https requests.
Upvotes: 8