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)
相关推荐
铁蛋AI编程实战19 小时前
ChatWiki 开源 AI 文档助手搭建教程:多格式文档接入,打造专属知识库机器人
java·人工智能·python·开源
程序员小远19 小时前
UI自动化测试用例管理平台搭建
自动化测试·软件测试·python·selenium·测试工具·职场和发展·测试用例
2301_7634725819 小时前
实时系统下的C++编程
开发语言·c++·算法
db_murphy19 小时前
知识篇 | net.ipv4.ip_forward 参数
网络·网络协议·tcp/ip
小明_GLC19 小时前
Docker 构建镜像一直卡在下载 Python?
python·docker·容器
Vect__19 小时前
TCP Socket编程详解
网络协议·tcp/ip·php
REDcker19 小时前
TCP 拥塞控制算法详解:CUBIC、BBR 及传统算法
tcp/ip·算法·php
科技块儿19 小时前
在线考试防作弊IP工具选型:5款主流IP查询API精度、成本、场景适配全测评
服务器·网络·tcp/ip·安全
阿猿收手吧!19 小时前
【C++】深入理解C++ Atomic内存序:解决什么问题?怎么用?
开发语言·c++
小白学大数据19 小时前
Python爬虫实现无限滚动页面的自动点击与内容抓取
开发语言·爬虫·python·pandas