From 35200458563c85a9f5ee1e8206e0527ea8f03cf6 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sun, 17 Dec 2023 15:28:42 +0100 Subject: [PATCH] =?UTF-8?q?On=20rend=20plus=20robuste=20l'import=20(dans?= =?UTF-8?q?=20le=20cas=20o=C3=B9=20il=20manque=20des=20informations)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agenda_culturel/extractors.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/agenda_culturel/extractors.py b/src/agenda_culturel/extractors.py index 1b58cab..1b1230b 100644 --- a/src/agenda_culturel/extractors.py +++ b/src/agenda_culturel/extractors.py @@ -144,10 +144,15 @@ class ExtractorFacebook(Extractor): self.get_neighbor_events(event[k]) elif k in ExtractorFacebook.FacebookEvent.rules: for nk, rule in ExtractorFacebook.FacebookEvent.rules[k].items(): + error = False c = event[k] for ki in rule: - c = c[ki] - self.elements[nk] = c + if c is not None: + c = c[ki] + else: + error = True + if not error: + self.elements[nk] = c else: self.elements[k] = event[k]