D
D
Dmitry2020-04-24 02:36:56
Python
Dmitry, 2020-04-24 02:36:56

Python, I start writing a weather bot, I press Enter in the console and it gives me an error, what's wrong?

I started learning Python, I'm starting to write a weather bot, I entered the API key, the place, I entered the city in the console, I press Enter and it gives me an error, what's wrong? b

import pyowm
owm = pyowm.OWM ( ' мой ключ ' )

place = input("В каком городе/стране?:")

observation = owm.weather_at_place(place)
w = observation.get_weather()
print(w)


В каком городе/стране?:Москва
Traceback (most recent call last):
  File "D:\Python\test.py", line 6, in <module>
    observation = owm.weather_at_place(place)
  File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyowm\weatherapi25\owm25.py", line 231, in weather_at_place
    _, json_data = self._wapi.cacheable_get_json(uri, params=params)
  File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyowm\commons\http_client.py", line 87, in cacheable_get_json
    status_code, data = self.get_json(uri, params=params, headers=headers)
  File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyowm\commons\http_client.py", line 32, in get_json
    HttpClient.check_status_code(resp.status_code, resp.text)
  File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyowm\commons\http_client.py", line 153, in check_status_code
    raise api_response_error.UnauthorizedError('Invalid API Key provided')
pyowm.exceptions.api_response_error.UnauthorizedError: Your API subscription level does not allow to perform this operation
Reason: Invalid API Key provided

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alfss, 2020-04-24
@Skoromaster33

pyowm.exceptions.api_response_error.UnauthorizedError: Your API subscription level does not allow to perform this operation
Reason: Invalid API Key provided

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question