Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,25 +12,34 @@ st.title("Base de données des pesticides de l'UE")
|
|
| 12 |
def get_products():
|
| 13 |
url = "https://api.datalake.sante.service.ec.europa.eu/sante/pesticides/pesticide_residues_products"
|
| 14 |
params = {"format": "json", "language": "FR", "api-version": "v2.0"}
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
response.raise_for_status()
|
| 17 |
return response.json()
|
| 18 |
|
| 19 |
# Fonction pour récupérer les LMR par produit
|
| 20 |
@st.cache_data
|
| 21 |
def get_mrls(product_id):
|
| 22 |
-
url =
|
| 23 |
params = {"format": "json", "product_id": product_id, "api-version": "v2.0"}
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
| 25 |
response.raise_for_status()
|
| 26 |
return response.json()
|
| 27 |
|
| 28 |
# Fonction pour récupérer les informations sur les substances
|
| 29 |
@st.cache_data
|
| 30 |
def get_substance_info(substance_id):
|
| 31 |
-
url =
|
| 32 |
params = {"format": "json", "pesticide_residue_id": substance_id, "api-version": "v2.0"}
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
| 34 |
response.raise_for_status()
|
| 35 |
return response.json()
|
| 36 |
|
|
|
|
| 12 |
def get_products():
|
| 13 |
url = "https://api.datalake.sante.service.ec.europa.eu/sante/pesticides/pesticide_residues_products"
|
| 14 |
params = {"format": "json", "language": "FR", "api-version": "v2.0"}
|
| 15 |
+
headers = {
|
| 16 |
+
"User-Agent": "StreamlitApp/1.0" # Identifie votre application
|
| 17 |
+
}
|
| 18 |
+
response = requests.get(url, params=params, headers=headers)
|
| 19 |
response.raise_for_status()
|
| 20 |
return response.json()
|
| 21 |
|
| 22 |
# Fonction pour récupérer les LMR par produit
|
| 23 |
@st.cache_data
|
| 24 |
def get_mrls(product_id):
|
| 25 |
+
url = "https://api.datalake.sante.service.ec.europa.eu/sante/pesticides/pesticide_residues_mrls"
|
| 26 |
params = {"format": "json", "product_id": product_id, "api-version": "v2.0"}
|
| 27 |
+
headers = {
|
| 28 |
+
"User-Agent": "StreamlitApp/1.0"
|
| 29 |
+
}
|
| 30 |
+
response = requests.get(url, params=params, headers=headers)
|
| 31 |
response.raise_for_status()
|
| 32 |
return response.json()
|
| 33 |
|
| 34 |
# Fonction pour récupérer les informations sur les substances
|
| 35 |
@st.cache_data
|
| 36 |
def get_substance_info(substance_id):
|
| 37 |
+
url = "https://api.datalake.sante.service.ec.europa.eu/sante/pesticides/pesticide_residues"
|
| 38 |
params = {"format": "json", "pesticide_residue_id": substance_id, "api-version": "v2.0"}
|
| 39 |
+
headers = {
|
| 40 |
+
"User-Agent": "StreamlitApp/1.0"
|
| 41 |
+
}
|
| 42 |
+
response = requests.get(url, params=params, headers=headers)
|
| 43 |
response.raise_for_status()
|
| 44 |
return response.json()
|
| 45 |
|