import requests
import time
import random
import re
url_test = 'http://shuidi.cn/company-fa448adbe2c4d85e55902adec6362bae.html'
url_proxy = 'http://tpv.daxiangdaili.com/ip/?tid=559307898014614&num=1&category=2&sortby=time'
# url_proxy = 'http://piping.mogumiao.com/proxy/api/get_ip_al?appKey=a7f685fff8cf479e9ed2cb654a71eccb&count=1&expiryDate=0&format=1&newLine=2'
proxies = {'http': 'http://10.2.1.229:9999', 'https': 'http://10.2.1.229:9999'}
count = 0
res = requests.get(url_proxy, proxies=proxies)
# pro_ip = re.findall('"ip":"(.*?)"}]', res.text)[0]
# pro_port = re.findall('"port":"(.*?)","ip"', res.text)[0]
# proxy = pro_ip + ':' + pro_port
proxy = res.text
proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy}
# proxies = {'http': '10.2.1.229:9999'}
print(proxies)
headers = {"Connection": "keep-alive",
# "Pragma": "no-cache",
"Cache-Control": "no-cache",
"User-Agent": 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.11 TaoBrowser/2.0 Safari/536.11',
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"DNT": "1",
"Cookie": '',
"Accept-Encoding": "gzip, deflate, sdch",
"Accept-Language": "zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4",
"Referer": 'http://www.qichacha.com',
"Accept-Charset": "gb2312,gbk;q=0.7,utf-8;q=0.7,*;q=0.7"}
start = time.time()
while count < 1:
try:
# session = requests.Session()
url_test_ip = 'https://www.ip138.com/'
url_test_i = 'http://www.douban.com'
response = requests.get(url_test, headers=headers, proxies=proxies, timeout=30, verify=False)
print(requests.utils.dict_from_cookiejar(response.cookies))
print(response.text)
print('============================count:%s=======================' % count)
count += 1
# time.sleep(random.uniform(0.1, 1))
except Exception as e:
print(4)
endtime = time.time()
print('::::::::::::::%f' % (endtime-start))
检测IP常用
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 在此总结自己常用的几种js判断数据类型的方法。定义几个变量备用: 1. typeof typeof可以检测出的数据...
- 检测点2.3 遵循指令被送入指令缓冲器 -> IP值自动增加 -> 指令被执行的顺序 : 四次修改 mov ax,...
- 追剧的时候不喜欢被别人打扰,儿子小心翼翼插了一句嘴,怏怏地问:“为啥叫‘白光’啊?……”,正在气头儿上为罗子群不甘...
- 定义变量 貌似很简单,大家看一下:var str=“你好”; // 单引号也可以 哦~~~ 如 var str=‘...