The API worhs for weather_at_place() but not for forecast_at_place()
See original GitHub issueThe API works with:
owm = pyowm.OWM(owm_token)
mgr = owm.weather_manager()
obs = mgr.weather_at_place('Roma')
But if I use:
daily_forecast = mgr.forecast_at_place('Roma', 'daily').forecast
It give me this error:
raise exceptions.UnauthorizedError('Invalid API Key provided')
pyowm.commons.exceptions.UnauthorizedError: Invalid API Key provided
With only the weather_at_place() code it works but if I add at the same program the forecast_at_place() it gives me this error.
Issue Analytics
- State:
- Created 3 years ago
- Comments:21 (8 by maintainers)
Top Results From Across the Web
PyOWM - Weather API not working as expected - Stack Overflow
The forecast_at_place() only works for old API Keys(or legacy keys) and doesn't work for newer keys as per my knowledge, its not the...
Read more >How to Use an API: Just the Basics 2022 | TechnologyAdvice
Ever wonder what an API is or how to use one? APIs allow one program to request data from another. Learn more about...
Read more >What Is an API? How APIs Work (for Non-Developers) - Auth0
An API is an intermediary piece of code that allows pieces of software to communicate with each other. APIs can speed the development...
Read more >How do APIs work? An in-depth guide - Tray.io
API stands for “application programming interface.” An API is essentially a set of rules that dictate how two machines talk to each other....
Read more >Introduction to web APIs - Learn web development | MDN
At this point, you should have a good idea of what APIs are, how they work, and what you can do with them...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Does it return temperature for the next day?
@EightFawn I’ve tested your exact code again on my side and it works like a charm
Now, I think here the issue is not with PyOWM but with the API key itself In your very first code snippet you said that querying for observed weather worked but querying for daily forecasted weather didn’t: both queries were working fine on my side.
So here my conjecture is: as my free API key was issued years ago and it seems that it calls OWM API endpoints that are now unaccessible to newer API keys.
I’ve checked out on the OWM API website: it seems that as of today, only calls to the “OneCall” endpoint are enabled for free API key - this might explain why calls work on my side (because I have a kind of “legacy” API key) and don’t work on yours.
This behaviour was completely unexpeted to me 😒
Luckily, you’ll hopefylly be able to retrieve both observed and daily forecasted data using the OneCall methods