diff options
Diffstat (limited to 'python/fatcat_tools')
-rw-r--r-- | python/fatcat_tools/harvest/doi_registrars.py | 4 | ||||
-rw-r--r-- | python/fatcat_tools/workers/elasticsearch.py | 2 |
2 files changed, 3 insertions, 3 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) diff --git a/python/fatcat_tools/workers/elasticsearch.py b/python/fatcat_tools/workers/elasticsearch.py index e7abd5ee..3adb088e 100644 --- a/python/fatcat_tools/workers/elasticsearch.py +++ b/python/fatcat_tools/workers/elasticsearch.py @@ -48,5 +48,5 @@ class ElasticsearchReleaseWorker(FatcatWorker): release.ident) print("Updating document: {}".format(elasticsearch_endpoint)) resp = requests.post(elasticsearch_endpoint, json=release_to_elasticsearch(release)) - assert resp.status_code in (200, 201) + resp.raise_for_status() #consumer.commit_offsets() |