代理服务器不更改 public IP 与 Python 请求

Proxy server doesn't change public IP with Python Requests

我是运行这个脚本:

import requests

proxyDict = {"http"  : 'http://81.93.73.28:8081'}

r = requests.get('http://ipinfo.io/ip', proxies=proxyDict)
r.status_code
r.headers['content-type']

r.encoding

print(r.text)

我试过自己的代理服务器以及几个 public 服务器。它仍然打印我当前的 ip。 我做错了什么?

问题似乎出在代理上。我用那个代码尝试了随机的、免费的。另外,您的代码有一些问题。您在没有使用的情况下调用属性 - 它们是不需要的。尝试使用该代码和代理,对我来说,它有效。

proxyDict = {"http"  : 'http://162.14.18.11:80'}

r = requests.get('http://ipinfo.io/ip', proxies=proxyDict, )
print(r.status_code)

print(r.text)