aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/harvest
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-12-29 00:07:14 -0800
committerBryan Newbold <bnewbold@robocracy.org>2018-12-29 00:07:14 -0800
commitd95fa771f5c9a75dece2038ee50619a53f9c43f7 (patch)
tree5126a6b0163abc748c0d3656aae73ad684fe7a80 /python/fatcat_tools/harvest
parent0f7fb8806c1a39aa54d0cd051aa48478c1b1c070 (diff)
downloadfatcat-d95fa771f5c9a75dece2038ee50619a53f9c43f7.tar.gz
fatcat-d95fa771f5c9a75dece2038ee50619a53f9c43f7.zip
check request status codes idiomatically
Diffstat (limited to 'python/fatcat_tools/harvest')
-rw-r--r--python/fatcat_tools/harvest/doi_registrars.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/python/fatcat_tools/harvest/doi_registrars.py b/python/fatcat_tools/harvest/doi_registrars.py
index d27389ba..4a0cb8db 100644
--- a/python/fatcat_tools/harvest/doi_registrars.py
+++ b/python/fatcat_tools/harvest/doi_registrars.py
@@ -95,11 +95,11 @@ class HarvestCrossrefWorker:
while True:
http_resp = requests.get(self.api_host_url, params, headers=headers)
if http_resp.status_code == 503:
- # crud backoff
+ # crude backoff
print("got HTTP {}, pausing for 30 seconds".format(http_resp.status_code))
time.sleep(30.0)
continue
- assert http_resp.status_code == 200
+ http_resp.raise_for_status()
resp = http_resp.json()
items = self.extract_items(resp)
count += len(items)