我正在尝试访问一个代理,我多次 ping 并且在线,以进行搜索。
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
Run Code Online (Sandbox Code Playgroud)
这是我的代码。我使用正则表达式在 html 代码中搜索 IP 的提及,它总是只返回我当前的 IP。我尝试了不同的网站,这些网站告诉我我的 IP,他们每个人都返回我当前的 IP,而不是我的代理。关于我做错了什么的任何建议。