import requests
import time
with open("info.txt", 'r',encoding='utf-8') as temp:
for url in temp.readlines():
print(url)
header = 'https'
if header in url:
print('')
else:
url="http://"+url
url = url.strip('\n')
with open("web.txt", 'r',encoding='utf-8') as web:
webs = web.readlines()
for web in webs:
web = web.strip()
u = url + web
print(u)
try:
r = requests.get(u)
except:
print("超时")
continue
# print("url为:"+u)
print("url为:" + u + ' ' + "状态为:%d" % r.status_code)
time.sleep(2) # 想睡多久看自己~
w = open('write.txt', 'w+')
for web in webs:
web = web.strip()
u = url + web
r = requests.get(u)
w.write("urls为:" + u + ' ' + "状态为:%d" %r.status_code + '\n')
Traceback (most recent call last):
File "C:/Users/xiongdong/PycharmProjects/url/info_poc.py", line 35, in <module>
r = requests.get(u)
requests.exceptions.ConnectionError: ('Connection aborted.', OSError(0, 'Error'))