首页 > 解决方案 > 如何使用代理 python 连接到网站

问题描述

我尝试的代码没有错误,但它打印我的 ip 而不是代理。

import requests
proxies = {
    "https://": "51.79.145.108:3128",
    "http://": "51.79.145.108:3128"
}
url="https://httpbin.org/ip"
r=requests.get(url, proxies=proxies)
ip=r.json()
print(ip)

标签: pythonproxypython-requests

解决方案


推荐阅读