我正在创建一个程序来确定请求 html 中的参数代理是否有效,但我认为它不是,当我在谷歌中搜索“我的 IP 是什么”并抓取它时,它返回我的原始 IP 地址而不是我的 IP在获取请求中传递给代理参数,请参见下面的代码:
from requests_html import HTMLSession
#do google search 'what is my IP'
url = 'https://www.google.com/search?q=what+is+my+IP&oq=what+is+my+IP&aqs=chrome..69i57j0l7.13217j0j7&sourceid=chrome&ie=UTF-8'
session = HTMLSession()
r=session.get(url,proxies={'http': 'http://161.202.226.194:80'})
r.html.render(timeout=25)
ip = r.html.xpath("//span[@style='font-size:20px']").text
print(ip)
ip 的输出是我的 IP 地址,但我期待通过代理参数传递的 '161.202.226.194:80'。请帮忙。谢谢