mirror of
https://github.com/Watchful1/PushshiftDumps.git
synced 2025-07-28 09:04:10 -04:00
Catch connection errors here
This commit is contained in:
parent
361f35a49e
commit
92ac7b7a35
1 changed files with 7 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue