Difference: TheWeatherApp (3 vs. 4)

Revision 42021-02-18 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

The weather app

Introduction

Line: 30 to 33
 This shows that the nearest city for which I can get a woeid is Zürich with the id:784794

Sending the request,using the method reponse = urequests.get(url) with the url below

Added:
>
>
 
https://www.metaweather.com/api/location/784794/

returns a json string of this type, from which you can pick the information of interest to you:

weatherjson.png

Changed:
<
<
response.status_code gives you the http return code (should be 200 if successful).
data = response.json() gets the json data for you and converts it into a Python dictionary from which you must extract the information relevant to you. I pick up this information and put it into a friendly GUI:
>
>
response.status_code gives you the http return code (should be 200 if successful).
data = response.json() gets the json data for you and converts it into a Python dictionary from which you must extract the information relevant to you. I pick up this information and put it into a friendly GUI:
  metaweather.png
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback