Skip to content

Commit

Permalink
Don't fail if no results
Browse files Browse the repository at this point in the history
  • Loading branch information
symroe committed Sep 2, 2023
1 parent aba8d0a commit 4275d48
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions write-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]


Expand All @@ -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
Expand Down

0 comments on commit 4275d48

Please sign in to comment.