From 6fde4be7e00283a26bf8fcf2579cb5c6e8026431 Mon Sep 17 00:00:00 2001 From: obskyr Date: Mon, 4 Dec 2017 14:43:08 +0100 Subject: [PATCH] Handle read timeouts as connection errors. Fixes #17! --- khinsider.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/khinsider.py b/khinsider.py index 85c39ad..06a5083 100644 --- a/khinsider.py +++ b/khinsider.py @@ -178,7 +178,7 @@ def friendlyDownloadFile(file, path, name, index, total, verbose=False): print("Couldn't download {}. Trying again...".format(name)) try: file.download(path) - except requests.ConnectionError: + except (requests.ConnectionError, requests.Timeout): pass else: break @@ -474,7 +474,7 @@ if __name__ == '__main__': print(soundtrack.id) except KeyboardInterrupt: print("Stopped download.") - except requests.ConnectionError: + except (requests.ConnectionError, requests.Timeout): print("Could not connect to KHInsider.") print("Make sure you have a working internet connection.") except Exception as e: