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)
相关推荐
AAA小肥杨1 小时前
基于k8s的Python的分布式深度学习训练平台搭建简单实践
人工智能·分布式·python·ai·kubernetes·gpu
LXS_3571 小时前
Day 05 C++ 入门 之 指针
开发语言·c++·笔记·学习方法·改行学it
etsuyou3 小时前
js前端this指向规则
开发语言·前端·javascript
shizhenshide3 小时前
为什么有时候 reCAPTCHA 通过率偏低,常见原因有哪些
开发语言·php·验证码·captcha·recaptcha·ezcaptcha
lichong9513 小时前
Git 检出到HEAD 再修改提交commit 会消失解决方案
java·前端·git·python·github·大前端·大前端++
Tiny番茄3 小时前
31.下一个排列
数据结构·python·算法·leetcode
mit6.8243 小时前
[Agent可视化] 配置系统 | 实现AI模型切换 | 热重载机制 | fsnotify库(go)
开发语言·人工智能·golang
友友马3 小时前
『 QT 』QT控件属性全解析 (一)
开发语言·前端·qt
小白学大数据4 小时前
实战:Python爬虫如何模拟登录与维持会话状态
开发语言·爬虫·python
一念&4 小时前
每日一个C语言知识:C 结构体
c语言·开发语言