From 84ecd340cf95ec55c186ed5e5664fe29044836c1 Mon Sep 17 00:00:00 2001 From: Mike Clark Date: Thu, 11 Jul 2019 23:12:12 +0000 Subject: [PATCH] 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. --- psaw/PushshiftAPI.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/psaw/PushshiftAPI.py b/psaw/PushshiftAPI.py index 7eabfb1..0f38fb8 100644 --- a/psaw/PushshiftAPI.py +++ b/psaw/PushshiftAPI.py @@ -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)