Browse Source

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.
merge-requests/8/head
Lucas Verney 5 years ago
parent
commit
054c5679bb
  1. 5
      flatisfy/fetch.py

5
flatisfy/fetch.py

@ -213,7 +213,7 @@ class WeboobProxy(object): @@ -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): @@ -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):

Loading…
Cancel
Save