获取代理池ip
import requests
res = requests.get('http://demo.spiderpy.cn/get/?type=https')
print(res.json())
print(res.json()['proxy'])
# 112.30.155.83:12792
使用代理ip发送请求
header = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36'
}
respone = requests.get('https://www.jianshu.com/', headers=header, proxies={'https': res.json()['proxy']})
print(respone.text)
标签:get,res,代理,json,https,使用,print,requests
From: https://www.cnblogs.com/wellplayed/p/18021419