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

colab and pyowm #434

Open
bbking78 opened this issue Apr 2, 2024 · 0 comments
Open

colab and pyowm #434

bbking78 opened this issue Apr 2, 2024 · 0 comments

Comments

@bbking78
Copy link

bbking78 commented Apr 2, 2024

hi,
not sure if this is the right place to ask, so pls bear with me....
I am playing aroung with pyowm in colab - works partly but I am a bit confused.
OWM billing plan: One Call API 3.0 free for 1000 request daily, afterwards 0.14 per 100 calls. (credit card added)

installed pyowm:

#!pip3 install pyowm
print("OWM Version: " + str(owm.version)) gives me
OWM Version: (3, 3, 0)

this works:

owm = OWM('<API-Key>')
mgr = owm.weather_manager()
daily_forecast = mgr.forecast_at_place('London,GB', 'daily')
for x in range(0,23):
  print("x is: " + str(x))
  tomorrow_at_time = timestamps.tomorrow(x, 0)                      # datetime object for tomorrow at 5 PM
  weather = daily_forecast.get_weather_at(tomorrow_at_time)
  print(weather.temperature(unit='celsius'))

it prints 23x the same values, like:
{'day': 13.85, 'min': 8.79, 'max': 14.12, 'night': 9.75, 'eve': 11.67, 'morn': 8.79, 'feels_like_day': 12.86, 'feels_like_night': 7.15, 'feels_like_eve': 10.96, 'feels_like_morn': 7.09}

so somehow not a daily forecast....

when trying OneCall 3.0 to stay up to date:
one_call=mgr.one_call(lat=52.5244, lon=13.4105)

it gives me

UnauthorizedError: Invalid API Key provided

but when I call this in a browser, this works:
https://api.openweathermap.org/data/3.0/onecall?lat=52.5244&lon=13.4105&units=metric&appid=API-key

what is wrong here, so that I cannot use the one_call function calls from pyowm?
thanks in advance!

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