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)
相关推荐
kkai人工智能3 小时前
AI写作:从“废话”到“爆款”
开发语言·人工智能·ai·ai写作
lizz316 小时前
C++模板编程:从入门到精通
java·开发语言·c++
吴佳浩6 小时前
Python入门指南(五) - 为什么选择 FastAPI?
后端·python·fastapi
shoubepatien7 小时前
JAVA -- 05
java·开发语言
寰天柚子7 小时前
Java并发编程中的线程安全问题与解决方案全解析
java·开发语言·python
沐知全栈开发7 小时前
Bootstrap 下拉菜单:设计与实现指南
开发语言
2503_928411567 小时前
项目中的一些问题(补充)
人工智能·python·tensorflow
Evand J7 小时前
【MATLAB例程】多锚点RSSI定位和基站选择方法,基于GDOP、基站距离等因素。以Wi-Fi定位为例,附下载链接
开发语言·matlab·定位·gdop·rssi
superman超哥7 小时前
仓颉语言中锁的实现机制深度剖析与并发实践
c语言·开发语言·c++·python·仓颉
vv_Ⅸ7 小时前
打卡day42
python