Python测试代理ip是否有效
import requests '''代理IP地址(高匿)''' proxy = { 'http': 'http://117.85.105.170:808', 'https': 'https://117.85.105.170:808' } '''head 信息''' head = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36', 'Connection': 'keep-alive'} '''http://icanhazip.com会返回当前的IP地址''' p = requests.get('http://icanhazip.com', headers=head, proxies=proxy) print(p.text)
相关推荐
yanghui0 2020-06-20
sicceer 2020-05-28
似水流年梦 2020-05-12
zhglinux 2020-01-09
81550392 2019-05-15
81550392 2011-06-24
gdb 2020-05-08
zhaolisha 2020-05-06
wanghongsha 2020-04-19
hygbuaa 2020-02-26
用不完的好奇心 2020-02-13
wanghongsha 2020-01-17
zhaolisha 2019-12-21
powerfj 2019-11-19
hygbuaa 2019-11-18
笑面依旧 2019-11-17