From 3a3dee65c2f3bbd23094ad87e66b0a75c5fa8b74 Mon Sep 17 00:00:00 2001 From: Mark Brough Date: Wed, 8 Nov 2023 17:03:31 +0100 Subject: [PATCH] Handle org-id.guide exception for now --- importers/organisation_registration_agency.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/importers/organisation_registration_agency.py b/importers/organisation_registration_agency.py index de2b9fc..708af43 100644 --- a/importers/organisation_registration_agency.py +++ b/importers/organisation_registration_agency.py @@ -1,5 +1,7 @@ from time import sleep +from requests.exceptions import HTTPError + from .helpers import Importer, fetch @@ -10,10 +12,16 @@ def refresh_data(): # # For more details, see: # https://github.com/OpenDataServices/org-ids/issues/256 - refresh_url = 'https://org-id.guide/_update_lists' - for x in range(6): - fetch(refresh_url) - sleep(0.5) + + try: + refresh_url = 'https://org-id.guide/_update_lists' + for x in range(6): + fetch(refresh_url) + sleep(0.5) + except HTTPError as exception: + if exception.response.status_code == 500: + print("Unable to ensure that org-id.guide is providing the latest data") + continue refresh_data()