Spaces:
Runtime error
Runtime error
Download data_manager.py from LaurentTRIPIED/OpenData-Projet-RSE: direct link, hf CLI and curl.
- Browser
- Download file 419 Bytes
-
https://huggingface.co/spaces/LaurentTRIPIED/OpenData-Projet-RSE/resolve/main/data_manager.py
- Command line
-
hf download hf://spaces/LaurentTRIPIED/OpenData-Projet-RSE/data_manager.py
-
curl -L -o data_manager.py https://huggingface.co/spaces/LaurentTRIPIED/OpenData-Projet-RSE/resolve/main/data_manager.py
419 Bytes
| # data_manager.py | |
| import requests | |
| def get_data(): | |
| url = "https://opendata.bordeaux-metropole.fr/api/records/1.0/search/?dataset=met_etablissement_rse&q=&rows=100" | |
| response = requests.get(url) | |
| if response.status_code == 200: | |
| data = response.json() | |
| records = data.get("records", []) | |
| return [record["fields"] for record in records], data.get("nhits", 0) | |
| else: | |
| return [], 0 | |