import requests
import time
url = ['https://blog.csdn.net/At_a_lost/article/details/108469516',
'https://blog.csdn.net/At_a_lost/article/details/108550043',
'https://blog.csdn.net/At_a_lost/article/details/109514263',
'https://blog.csdn.net/At_a_lost/article/details/109100093',
'https://blog.csdn.net/At_a_lost/article/details/109531309',
'https://blog.csdn.net/At_a_lost/article/details/109548154',
'https://blog.csdn.net/At_a_lost/article/details/109548154',
'https://blog.csdn.net/At_a_lost/article/details/109550954']
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36'}
count = 0
countUrl = len(url)
# 访问次数设置
while count < 10000:
try: # 正常运行
for i in range(countUrl):
response = requests.get(url[i], headers=headers)
if response.status_code == 200:
count = count + 1
print('Success ' + str(count), 'times')
time.sleep(75)
except Exception: # 异常
print('Failed and Retry')
time.sleep(60)