From 054c5679bb1bc85f0e464cb073e1af707d8fd25a Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Tue, 20 Jun 2017 13:27:08 +0200 Subject: [PATCH] Handle exceptions raised when fetching details Weboob does handle the raised exceptions when fetching housing posts through the `WebNip` class. However, when fetching details, we directly call the Weboob backend method and no exceptions handling is done. When importing data with a `crontask`, websites may be offline for some time, especially at night, then leading to a failure in import process. Let's just handle such exceptions so that an offline website does not break the whole import process. Details from the temporary offline websites which could not be fetched will be fetched at next run. This closes #60. --- flatisfy/fetch.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/flatisfy/fetch.py b/flatisfy/fetch.py index 13a5012..dcf0a0e 100644 --- a/flatisfy/fetch.py +++ b/flatisfy/fetch.py @@ -213,7 +213,7 @@ class WeboobProxy(object): housing.id = full_flat_id return json.dumps(housing, cls=WeboobEncoder) - except CallErrors as exc: + except Exception as exc: # If an error occured, just log it LOGGER.error( "An error occured while fetching housing %s: %s", @@ -221,9 +221,6 @@ class WeboobProxy(object): str(exc) ) return "{}" - except ValueError as exc: - LOGGER.error("ValueError for flat_id=%s: %s", flat_id, str(exc)) - return "{}" def fetch_flats(config):