Étape 2: Accédez au Wundergrounds API
Le Weather Underground (http://www.wunderground.com) fournit des informations météorologiques en ligne en temps réel assistées par une installation réseau de 140 000 + stations météorologiques personnelles partout dans le monde. Il est, il y a une station de météo personnelle Weather Underground près de chez vous. L’aspect vraiment cool de Wunderground est qu’ils ont une API que nous pouvons utiliser pour récupérer les données météorologiques (pratiquement) n’importe où dans le monde.
Température, point de rosée, vent de rafale, précipitations, pression, humidité, indice UV,... tous facilement disponibles pour chaque fois que nous voulons, quand nous voulons. Nous allons apprendre à utiliser les API super-simple de Wunderground.
Weather Underground est une marque déposée de The Weather Channel, LLC. tous les deux aux Etats-Unis et à l’étranger. Le Logo de Météo Underground est une marque du Weather Underground, LLC.
Pour pouvoir utiliser l’API Wunderground, vous devez tout d’abord votre propre clé API. Obtenir une clé API est rapide et gratuit.
1. aller sur : http://www.wunderground.com/weather/api/?MR=1.Cli...
2. cliquez sur « Inscrivez-vous gratuitement! ».
3. créer un compte et cliquez sur le lien envoyé dans un e-mail de validation pour activer votre compte
4. Connectez vous
5. allez à tarification et sélectionnez le Plan libre de Stratus (sélection par défaut). Vous obtenez 500 appels d’API par jour pour 0 $. Il n’y a aucune carte de crédit nécessaire pour obtenir le level API développeur.
6. cliquez sur « Acheter la clé »
7. remplir le formulaire et le soumettre pour obtenir votre clé API
Votre clé ressemblera à quelque chose comme ceci : 0def10027afaebb7. Enregistrez-la.
Vous pouvez faire une API à Wunderground en tapant un URL dans votre navigateur dans le format suivant :
http://API.wunderground.com/API/YOUR_API_KEY/conditions/q/THE_DESIRED_STATE/THE_DESIRED_CITY.JSON
par exemple, pour obtenir la météo à San Francisco, CA :
http://API.wunderground.com/API/0def10027afaebb7/conditions/q/ca/San_Francisco.JSON
pour obtenir la météo à Londres :
de http://API.wunderground.com/API/0def10027afaebb7/conditions/q/UK/London.jsonLet
Regardez ce qui est retourné :
{
« réponse »: {« version »: "0.1", "termsofService": « http://www.wunderground.com/weather/api/d/terms.html », « caractéristiques »: {« conditions »: 1}}, « current_observation »: {« image »: {« url »: « http://icons.wxug.com/graphics/wu2/logo_130x80.png », « title »: "Weather Underground", "link": « http://www.wunderground.com »}, « display_location »: {« complet »: "London, United Kingdom", « ville »: "London", "Etat": "", "state_name": "United Kingdom", "pays": "UK", "country_iso3166": "GB", "zip": "00000", "magique": "1", "OMM": "03772", "latitude": "51.47999954", "longitude": "-0.44999999", "elevation": "24.00000000"}, "observation_location" : {« complet »: "London", « ville »: "London", "Etat": "", "country": "UK", "country_iso3166": "GB", "latitude": "51.47750092", "longitude": "-0.46138901", "elevation": "79 ft"}, "estime": {}, "station_id": "EGLL", "observation_time": "dernière mise à jour le 23 octobre, 05:50 BST", "observation_time_rfc822": "vendredi 23 octobre 2015 05:50 + 0100", "observation_epoch": "1445575800", "local_time_rfc822": "vendredi 23 octobre 2015 06:13:53 + 0100", "local_epoch": "1445577233", "local_tz_short": "STB", "local_tz_long" : "Europe/London", "local_tz_offset": "+ 0100", "météo": "Couvert", "temperature_string": "50 F (10 ° C)", "temp_f": 50, "temp_c": 10, "relative_humidity": "87 %", "wind_string": "à partir de la Variable à 4 km/h", "wind_dir": "Variable", "wind_degrees": 0, "wind_mph": 4, "wind_gust_mph": 0, "wind_kph": 6, "wind_gust_kph": 0, "pressure_mb": "1022", "pressure_in": "30,18", "pressure_trend": "0", "dewpoint_string": "46 F (8c)" , « dewpoint_f »: 46, « dewpoint_c »: 8, « heat_index_string »: "NA", "heat_index_f": "NA", "heat_index_c": "NA", "windchill_string": "NA", "windchill_f": "NA", "windchill_c": "NA", "feelslike_string": "50 F (10 ° C)", "feelslike_f": "50", "feelslike_c": "10", "visibility_mi": "6.2", "visibility_km": "10.0", "solarradiation": "--", « UV »: "0","precip_1hr_string": "-9999.00 (-9999.00 mm)", "precip_1hr_in": "-9999.00", "precip_1hr_metric" : "--", "precip_today_string": "in 0.00 (0.0 mm)", "precip_today_in": "0.00", "precip_today_metric": "0.0", "icône": "nuageux", "icon_url": "http://icons.wxug.com/i/c/k/nt_cloudy.gif", "forecast_url": "http://www.wunderground.com/global/stations/03772.html", "history_url": "http://www.wunderground.com/history/airport/EGLL/2015/10/23/DailyHistory.html", "ob_url": "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=51.47750092,-0.46138901", "purs": ""}}
Regardez toutes ces données un temps radieux. Nous avons juste besoin de faire un script pour analyser, puis l’expédier à un tableau de bord sur le web. Tout d’abord, nous allons configurer la destination pour nos données -> État Initial.