设置代理
代理(英语:Proxy),也称网络代理,是一种特殊的网络服务,英文全称是(Proxy Server),其功 能就是代理网络用户去取得网络信息。形象的说:它是网络信息的中转站。代理服务器就好象一个大的 Cache,这样就能显著提高浏览速度和效率。
免费代理地址:https://proxy.mimvp.com/freesecret?proxy=in_hp&sort=&page=1
Requests模块设置代理的方式如下
import requests
# 设置代理,多用于爬虫
proxies = {"http":"http://12.34.56.79:9527",
"https":"https://12.34.56.79:9527"}
# 1,普通的代理
res = requests.get(url="http://www.hnxmxit.com",proxies=proxies)
print(res.content.decode("utf-8"))
# 2,携带了登录的用户名和密码
# proxies1 = {"http":"http://用户名:密码@12.34.56.79:9527"}
# res = requests.get(url="http://hmxmxit.com",proxies=proxies1)
# print(res.content.decode("utf-8"))

2081

被折叠的 条评论
为什么被折叠?



