OpenData-Projet-RSE / data_manager.py
LaurentTRIPIED's picture
Pytorch v.48
3c1cd3f
raw
history blame contribute delete
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