From 5343f536610cd76fd2c30e3e6b070a1f876e7514 Mon Sep 17 00:00:00 2001 From: moanos Date: Fri, 23 May 2025 20:03:28 +0200 Subject: [PATCH] feat: skip rescues that already exist --- scripts/upload_animal_shelters.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/upload_animal_shelters.py b/scripts/upload_animal_shelters.py index ac65fb3..f8f9384 100644 --- a/scripts/upload_animal_shelters.py +++ b/scripts/upload_animal_shelters.py @@ -82,6 +82,14 @@ def main(): if "name" not in tierheim["properties"].keys() or "addr:city" not in tierheim["properties"].keys(): continue + # Check if rescue organization exits + search_data = {"external_source_identifier": "OSM", + "external_object_identifier": f"{tierheim["id"]}"} + search_result = requests.get(f"{instance}/api/organizations", json=search_data, headers=h) + if search_result.status_code == 200: + print(f"{tierheim["properties"]["name"]} already exists.") + continue + location_data = { "place_id": tierheim["id"], "latitude": tierheim["geometry"]["coordinates"][0][0][0],