Python3 请求未使用 passed-in 代理

Python3 Requests not using passed-in proxy

Requests 没有使用我传递给它的代理。 url 我正在使用的站点显示了请求来自哪个 ip——而且它始终是我的 ip 而不是代理 ip。我从 sslproxies.org 获取我的代理 ips,这应该是匿名的。

    url = 'http://www.lagado.com/proxy-test'
    proxies = {'http': 'x.x.x.x:xxxx'}
    headers = {'User-Agent': 'Mozilla...etc'}

    res = requests.get(url, proxies=proxies, headers=headers)

是否需要使用某些 headers 或需要配置的其他东西,以便我的 ip 对服务器隐藏?

docs状态

that proxy URLs must include the scheme.

其中方案是 scheme://hostname。因此,您应该将 'http://' 或 'socks5://' 添加到您的代理 URL,具体取决于您使用的协议。