Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API query used that does not work on free account in openweathermap.org #7

Open
peterb99 opened this issue Sep 29, 2022 · 0 comments
Open

Comments

@peterb99
Copy link

I see the following two API queries used to extract weather data from openweathermap.org

http://api.openweathermap.org/data/2.5/weather?q=Edinburgh%2C%20UK&lang=en&units=metric&appid=xxxxxxxxxxxxxx http://api.openweathermap.org/data/2.5/forecast/daily?q=Edinburgh%2C%20UK&lang=en&units=metric&cnt=5&appid=xxxxxxx

The second query returns:
{"cod":401, "message": "Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."}
This is because the second query is not supported when only having a free account.
Taking the 'daily' out of the URL would work:

http://api.openweathermap.org/data/2.5/forecast/?q=Edinburgh%2C%20UK&lang=en&units=metric&cnt=5&appid=xxxxxxxxxx

{"cod":"200","message":0,"cnt":5,"list":[{"dt":1664452800,"main":{"temp":13.21,"feels_like":12.68,"temp_min":13.21,"temp_max":13.84,"pressure":1008,"sea_level":1008,"grnd_level":1001,"humidity":80,"temp_kf":-0.63},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"clouds":{"all":46},"wind":{"speed":3.77,"deg":67,"gust":4.86},"visibility":10000,"pop":0.02,"sys":{"pod":"d"},"dt_txt":"2022-09-29 12:00:00"},{"dt":1664463600,"main":{"temp":13.54,"feels_like":12.88,"temp_min":13.54,"temp_max":13.86,"pressure":1009,"sea_level":1009,"grnd_level":1001,"humidity":74,"temp_kf":-0.32},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":52},"wind":{"speed":2,"deg":69,"gust":1.97},"visibility":10000,"pop":0,"sys":{"pod":"d"},"dt_txt":"2022-09-29 15:00:00"},{"dt":1664474400,"main":{"temp":11.79,"feels_like":11.14,"temp_min":11.79,"temp_max":11.79,"pressure":1010,"sea_level":1010,"grnd_level":1001,"humidity":81,"temp_kf":0},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"clouds":{"all":43},"wind":{"speed":1.25,"deg":111,"gust":1.47},"visibility":10000,"pop":0,"sys":{"pod":"n"},"dt_txt":"2022-09-29 18:00:00"},{"dt":1664485200,"main":{"temp":10.82,"feels_like":10.05,"temp_min":10.82,"temp_max":10.82,"pressure":1009,"sea_level":1009,"grnd_level":1000,"humidity":80,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":51},"wind":{"speed":1.98,"deg":189,"gust":2.17},"visibility":10000,"pop":0,"sys":{"pod":"n"},"dt_txt":"2022-09-29 21:00:00"},{"dt":1664496000,"main":{"temp":10.03,"feels_like":9.23,"temp_min":10.03,"temp_max":10.03,"pressure":1006,"sea_level":1006,"grnd_level":998,"humidity":82,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":76},"wind":{"speed":2.57,"deg":177,"gust":4.52},"visibility":10000,"pop":0,"sys":{"pod":"n"},"dt_txt":"2022-09-30 00:00:00"}],"city":{"id":2650225,"name":"Edinburgh","coord":{"lat":55.9521,"lon":-3.1965},"country":"GB","population":435791,"timezone":3600,"sunrise":1664431880,"sunset":1664474093}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant