I am looping through links and there are times when link can not be reached. I get back an HTTPERROR listed below
This is the code I am trying to run so if I get HTTPError Sleep for 5 minutes and try again.
try:
content, _ = http_request_get(url=polylink,payload={'t':''},parse=True)
except HTTPError:
print('Link Fail wait 5 Minutes try Again')
time.sleep(300)
continue
This is the error I get
HTTPError Traceback (most recent call last)
c:\Users\UserName\Documents\DataScience\Stocks\PolygonStockData2.py in
110 print(polylink)
111 try:
---> 112 content, _ = http_request_get(url=polylink,payload={'t':''},parse=True)
113 except HTTPError:
114 print('Link Fail wait 5 Minutes try Again')
Why wont my try catch ever get to the sleep command to try again?