aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-05-13 14:07:58 -0700
committerBryan Newbold <bnewbold@archive.org>2020-05-13 14:07:58 -0700
commit2b05717da36452f3eaf9f33b26df133a4fbaba6b (patch)
tree05a37a3c1b6271d3ef99077912532c335971beef
parentbe805be033168eb6cba55b76f008bf813e6c169c (diff)
downloadfatcat-covid19-2b05717da36452f3eaf9f33b26df133a4fbaba6b.tar.gz
fatcat-covid19-2b05717da36452f3eaf9f33b26df133a4fbaba6b.zip
small improvements to deliver_file2disk.py
-rwxr-xr-xbin/deliver_file2disk.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/deliver_file2disk.py b/bin/deliver_file2disk.py
index dd9ab30..6eaf925 100755
--- a/bin/deliver_file2disk.py
+++ b/bin/deliver_file2disk.py
@@ -151,6 +151,8 @@ class DeliverFatcatDisk:
return ('too-many-redirects', None)
except requests.exceptions.ChunkedEncodingError:
return ('chunked-encoding', None)
+ except requests.exceptions.ConnectionError:
+ return ('connection-error', None)
if resp.status_code != 200:
return ('fetch:{}'.format(resp.status_code), None)
else:
@@ -172,6 +174,8 @@ class DeliverFatcatDisk:
continue
status, content = self.fetch_content(url)
if status == 'success':
+ if not content:
+ return ('null-blob', sha1hex, None)
# TODO: verify sha1hex
file_meta = gen_file_metadata(content)
if file_meta['sha1hex'] != sha1hex: