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)
相关推荐
LXS_35710 分钟前
Day 18 C++提高 之 STL常用容器(string、vector、deque)
开发语言·c++·笔记·学习方法·改行学it
王琦031844 分钟前
Python 函数详解
开发语言·python
胡伯来了1 小时前
13. Python打包工具- setuptools
开发语言·python
小鸡吃米…1 小时前
Python 中的多层继承
开发语言·python
deng-c-f1 小时前
Linux C/C++ 学习日记(53):原子操作(二):实现shared_ptr
开发语言·c++·学习
中國移动丶移不动1 小时前
Python MySQL 数据库操作完整示例
数据库·python·mysql
落叶,听雪1 小时前
AI建站推荐
大数据·人工智能·python
wanghowie1 小时前
01.07 Java基础篇|函数式编程与语言新特性总览
java·开发语言·面试
ZAz_1 小时前
DAY 45 预训练模型
python
Cricyta Sevina2 小时前
Java IO 基础理论知识笔记
java·开发语言·笔记