python的requests爬虫模块使用代理ip方法---集合

形式一

python 复制代码
import requests
proxies = {'http':'128.3.74.224:2890','https':'128.3.74.224:2890'}
ip = requests.get('http://httpbin.org/ip',proxies=proxies)
print(ip.text)

形式二

形式一不行的情况下,试试形式二

python 复制代码
import requests
proxies = {'http':'http://127.0.0.1:7890','https':'https://127.0.0.1:7890'}
ip = requests.get('http://httpbin.org/ip',proxies=proxies)
print(ip.text)

形式三

带有账号密码的使用方法

python 复制代码
import requests
proxies = {'http':'user123:psw123@43.xxx.xxx.113:10801','https':'user123:psw123@43.xxx.xxx.113:10801'}
ip = requests.get('http://httpbin.org/ip',proxies=proxies)
print(ip.text)
相关推荐
一路向北·重庆分伦1 分钟前
03-01:MQ常见问题梳理
java·开发语言
txinyu的博客6 分钟前
结合游戏场景理解,互斥锁,读写锁,自旋锁,CAS / 原子变量,分段锁
开发语言·c++·游戏
阿里嘎多学长14 分钟前
2026-01-11 GitHub 热点项目精选
开发语言·程序员·github·代码托管
yuanyikangkang15 分钟前
STM32 lin控制盒
开发语言
万行21 分钟前
机器学习&第二章线性回归
人工智能·python·机器学习·线性回归
nervermore99026 分钟前
3.3 Python图形编程
python
zhengfei61127 分钟前
世界各地免费电视频道的 M3U 播放列表。
python
txinyu的博客1 小时前
HTTP服务实现用户级窗口限流
开发语言·c++·分布式·网络协议·http
代码村新手1 小时前
C++-类和对象(上)
开发语言·c++