From ff55bf0028095b79014e6b74f669a3bdc26b502d Mon Sep 17 00:00:00 2001 From: eric Date: Sun, 27 Sep 2020 18:54:10 -0400 Subject: [PATCH] catch connection errors in bookloader --- core/bookloader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/bookloader.py b/core/bookloader.py index cad98acb..17eecc05 100755 --- a/core/bookloader.py +++ b/core/bookloader.py @@ -770,7 +770,10 @@ def _get_json(url, params={}, type='gb'): if type == 'gb': params['key'] = settings.GOOGLE_BOOKS_API_KEY params['country'] = 'us' - response = requests.get(url, params=params, headers=headers) + try: + response = requests.get(url, params=params, headers=headers) + except requests.exceptions.ConnectionError: + raise LookupFailure("GET failed: url=%s and params=%s" % (url, params)) if response.status_code == 200: return json.loads(response.content) else: