aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-02-22 12:33:37 -0800
committerBryan Newbold <bnewbold@archive.org>2020-02-22 12:33:41 -0800
commitd08aac7381a392cecfe8931821df5e149b58f32a (patch)
treea0dfa21ce741d3c963d031bd468142202debfcd6
parent06d85e6004de36b7162e11d5171e2eab79f9c78a (diff)
downloadsandcrawler-d08aac7381a392cecfe8931821df5e149b58f32a.tar.gz
sandcrawler-d08aac7381a392cecfe8931821df5e149b58f32a.zip
cdx: handle empty/null CDX response
Sometimes seem to get empty string instead of empty JSON list
-rw-r--r--python/sandcrawler/ia.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/python/sandcrawler/ia.py b/python/sandcrawler/ia.py
index dbafa01..31f0260 100644
--- a/python/sandcrawler/ia.py
+++ b/python/sandcrawler/ia.py
@@ -123,6 +123,8 @@ class CdxApiClient:
if resp.status_code != 200:
raise CdxApiError(resp.text)
#print(resp.url, file=sys.stderr)
+ if not resp.text:
+ return None
rj = resp.json()
if len(rj) <= 1:
return None