码迷,mamicode.com
首页 > 其他好文 > 详细

requests模块使用代理

时间:2020-07-04 17:11:48      阅读:47      评论:0      收藏:0      [点我收藏+]

标签:apple   baidu   utf-8   htm   alt   png   python   head   get   

找一个免费IP的网站
技术图片

# coding=utf-8
import requests
proxies = {"http":"http://114.234.80.188:80"}#就代理填到这里
headers = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"}
r = requests.get("http://www.baidu.com",proxies=proxies,headers=headers)
print(r.status_code)

requests模块使用代理

标签:apple   baidu   utf-8   htm   alt   png   python   head   get   

原文地址:https://www.cnblogs.com/SunChuangYu/p/13235184.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!