From 6740783dbc05a75d8d873d5ff17d647d177cf0fe Mon Sep 17 00:00:00 2001 From: Tipragot Date: Wed, 8 Nov 2023 11:34:17 +0100 Subject: [PATCH] Ajout pyowm --- Chapitre 3 - Modularité/requettes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Chapitre 3 - Modularité/requettes.py b/Chapitre 3 - Modularité/requettes.py index e09b364..77d8dd3 100644 --- a/Chapitre 3 - Modularité/requettes.py +++ b/Chapitre 3 - Modularité/requettes.py @@ -3,3 +3,8 @@ import json url = 'https://api.openweathermap.org/data/2.5/weather' reponse = requests.get(url+'?q=Paris&appid=0001aa32345d1df47456f64b45f8170b') print(reponse.json()) + +from pyowm.owm import OWM +manager = OWM('0001aa32345d1df47456f64b45f8170b').weather_manager() # obtenir un accès au site +observation = manager.weather_at_place('Paris') # obtenir la météo d'une ville +print(observation.weather.status, observation.weather.temperature('celsius')) \ No newline at end of file