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)
相关推荐
xlq223224 小时前
22.多态(上)
开发语言·c++·算法
666HZ6664 小时前
C语言——高精度加法
c语言·开发语言·算法
Wise玩转AI4 小时前
Day 27|智能体的 UI 与用户交互层
人工智能·python·ui·ai·chatgpt·ai智能体
星释4 小时前
Rust 练习册 100:音乐音阶生成器
开发语言·后端·rust
_星辰大海乀4 小时前
IP 协议
服务器·网络·tcp/ip·nat·子网掩码·ip协议
s***46984 小时前
【玩转全栈】----Django模板语法、请求与响应
数据库·python·django
风生u5 小时前
go进阶语法
开发语言·后端·golang
666HZ6665 小时前
C语言——黑店
c语言·开发语言
Gomiko5 小时前
JavaScript基础(八):函数
开发语言·javascript·ecmascript
runepic5 小时前
Python + PostgreSQL 批量图片分发脚本:分类、去重、断点续拷贝
服务器·数据库·python·postgresql