thandle ReadTimeout exception in download() - amprolla - devuan's apt repo merger
 (HTM) git clone git://parazyd.org/amprolla.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 9bd473b1473e43464125431c544305e5a132c941
 (DIR) parent 45ee23d47b52dd55d36b3ac7bb1f5fa6ad0f5ed7
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Sat, 22 Jul 2017 11:10:34 +0200
       
       handle ReadTimeout exception in download()
       
       Diffstat:
         M lib/net.py                          |       9 +++++----
       
       1 file changed, 5 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git a/lib/net.py b/lib/net.py
       t@@ -21,15 +21,16 @@ def download(uris):
        
            try:
                r = requests.get(url, stream=True, timeout=20)
       -    except requests.exceptions.ConnectionError:
       -        warn("Caught exception: Connection reset. Retrying.")
       +    except (requests.exceptions.ConnectionError,
       +            requests.exceptions.ReadTimeout) as e:
       +        warn('Caught exception: "%s". Retrying...' % e)
                return download(uris)
        
            if r.status_code == 404:
       -        warn("failed: 404 not found!")
       +        warn('failed: 404 not found!')
                return
            elif r.status_code != 200:
       -        die("failed: %d" % r.status_code)
       +        die('failed: %d' % r.status_code)
        
            makedirs(dirname(path), exist_ok=True)
            f = open(path, 'wb')