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:
Mike Clark
2019-07-11 23:12:12 +00:00
committed by GitHub
parent 5702abdd1a
commit 84ecd340cf
+2
View File
@@ -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)