Catch connection errors here

This commit is contained in:
Watchful1 2023-08-28 19:36:25 -07:00
parent 361f35a49e
commit 92ac7b7a35

View file

@ -31,9 +31,13 @@ def query_pushshift(ids, bearer, object_type):
log.debug(f"pushshift query: {url}")
response = None
for i in range(4):
try:
response = requests.get(url, headers={
'User-Agent': "In script by /u/Watchful1",
'Authorization': f"Bearer {bearer}"}, timeout=15)
except ConnectionError:
time.sleep(2)
continue
if response.status_code == 200:
break
if response.status_code == 403: