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)
相关推荐
what_20181 分钟前
idea启动项目配置环境变量(nacos 命名空间)
java·开发语言
Fantasydg7 分钟前
JSP学习
java·开发语言·学习
温暖名字27 分钟前
调用qwen3-omni的api对本地文件生成视频文本描述(批量生成)
python·音视频·qwen·qa问答
太空程序猿37 分钟前
数据类型与变量
java·开发语言
rit84324991 小时前
MATLAB实现图像PCA降噪
开发语言·计算机视觉·matlab
*小雪1 小时前
uniapp写H5授权登录及分享,返回到目标页面
开发语言·javascript·uni-app
一眼万里*e1 小时前
搭建个人知识库
python
ghie90902 小时前
C#语言中使用“using“关键字的介绍
开发语言·c#
程序员小远2 小时前
软件测试之bug分析定位技巧
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·bug
七夜zippoe2 小时前
Java性能调优工具篇:JMH基准测试与Profiler(JProfiler/Async-Profiler)使用指南
java·开发语言·jprofiler·jmh·async-profiler