Add response code 500 error handling in reddit api
This commit is contained in:
@@ -162,6 +162,12 @@ class RedditAPI:
|
|||||||
backoff *= 2
|
backoff *= 2
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
logger.warning("Server error from Reddit API. Retrying...")
|
||||||
|
time.sleep(backoff)
|
||||||
|
backoff *= 2
|
||||||
|
continue
|
||||||
|
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user