python - 如何使用代理 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)
解决方案
推荐阅读
- python - 将不同子文件夹中同名的 csv 文件合并为一个 csv
- python - 有没有办法将所有类型的私钥表示为正则表达式?(不管它们是否有效)
- javascript - Firestore 不要求创建索引但查询有效
- reactjs - 如何将一个类的功能添加到组件中的另一个功能中?
- mysql - 如何删除 MariaDB 并为 Postfix 安装 MySQL?
- java - 在没有 Activity 的情况下读取 Android Studio 中的文件
- javascript - 删除课程后如何恢复课程?
- c++ - 如何使用 Xcode 在 C++ 运行时清除屏幕?
- jquery - 如何使用jQuery添加选中复选框的值并选择选项到textarea?
- swift - 实现存储库模式时避免类型擦除