mirror of
https://github.com/wassname/psaw.git
synced 2026-09-09 11:30:51 +08:00
Warn about which non 200 code
Warn about non-200 codes. For example, I was getting a 414: Url too long which including too many comment ids.
This commit is contained in:
@@ -158,6 +158,8 @@ class PushshiftAPIMinimal(object):
|
||||
except requests.ConnectionError:
|
||||
continue
|
||||
success = response.status_code == 200
|
||||
if not success:
|
||||
warnings.warn("Got non 200 code %s" % response.status_code)
|
||||
if not success:
|
||||
raise Exception("Unable to connect to pushshift.io. Max retries exceeded.")
|
||||
return json.loads(response.text)
|
||||
|
||||
Reference in New Issue
Block a user