From e3c48eac24732484346d147fadd0c7f76235d98c Mon Sep 17 00:00:00 2001 From: moanos Date: Mon, 14 Jul 2025 07:16:17 +0200 Subject: [PATCH] feat: fail more gracefully --- scripts/upload_animal_shelters.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/upload_animal_shelters.py b/scripts/upload_animal_shelters.py index d5c0074..a392044 100644 --- a/scripts/upload_animal_shelters.py +++ b/scripts/upload_animal_shelters.py @@ -178,8 +178,13 @@ def create_location(tierheim, instance, headers): location_result = requests.post(f"{instance}/api/locations/", json=location_data, headers=headers) if location_result.status_code != 201: - print( - f"Location for {tierheim["properties"]["name"]}:{location_result.status_code} {location_result.json()} not created") + try: + print( + f"Location for {tierheim["properties"]["name"]}:{location_result.status_code} {location_result.json()} not created") + except requests.exceptions.JSONDecodeError: + print(f"Location for {tierheim["properties"]["name"]} could not be created") + exit() + return location_result.json()