diff --git a/write-data.py b/write-data.py index 370b35b5b0..df4b172539 100644 --- a/write-data.py +++ b/write-data.py @@ -85,6 +85,8 @@ def from_code_commit(cls: "LogRun", json_data): def make_ee_request(council_id: str) -> dict: url = urljoin(EE_BASE_URL, f"/api/organisations/local-authority/{council_id}/") results = requests.get(url).json() + if not results["results"]: + return None return results["results"][0] @@ -96,6 +98,8 @@ def council_past_end_date(council_id: str) -> bool: """ metadata = make_ee_request(council_id) + if not metadata: + return False end_date = metadata.get("end_date") if not end_date: return False