發表文章

目前顯示的是 11月 6, 2018的文章

How to use the requests module to skip connection timeout urls

圖片
up vote 2 down vote favorite Hi how can i use the request module to go through a bunch of URLs and if a url in the list takes more time to load or a connection timeout how can i skip that particular url and skip to the next one def req(): with open('demofile.txt','r') as http: for url in http.readlines(): req = url.strip() print(req) page=requests.get("http://"+req,verify=False) if page.status_code == 400: break else: continue time.sleep(1) python python-3.x python-requests share | improve this question asked 2 days ago Ra

How to use the requests module to skip connection timeout urls

圖片
up vote 2 down vote favorite Hi how can i use the request module to go through a bunch of URLs and if a url in the list takes more time to load or a connection timeout how can i skip that particular url and skip to the next one def req(): with open('demofile.txt','r') as http: for url in http.readlines(): req = url.strip() print(req) page=requests.get("http://"+req,verify=False) if page.status_code == 400: break else: continue time.sleep(1) python python-3.x python-requests share | improve this question asked 2 days ago Ra