commit 5c55549a68fec31bd673487b65cd0cb4ca0ccfd6 parent ae0f2f3219c8d65dbf826b49845ed37534fd1443 Author: parazyd <parazyd@dyne.org> Date: Wed, 28 Jun 2017 10:23:38 +0200 try to handle connection interrupts in net.download Diffstat:
M | lib/net.py | | | 6 | +++++- |
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/net.py b/lib/net.py @@ -19,7 +19,11 @@ def download(uris): path = uris[1] info("dl: %s" % url) - r = requests.get(url, stream=True) + try: + r = requests.get(url, stream=True) + except requests.exceptions.ConnectionError: + warn("Caught exception: Connection reset. Retrying.") + download(uris) if r.status_code == 404: warn("failed: 404 not found!")