invalid api key provided pyowm что делать

The API worhs for weather_at_place() but not for forecast_at_place() #316

Comments

EightFawn commented Jun 4, 2020

The API works with:

daily_forecast = mgr.forecast_at_place(‘Roma’, ‘daily’).forecast

It give me this error:

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.

The text was updated successfully, but these errors were encountered:

csparpa commented Jun 7, 2020 •

Please let me know!

Karan-Ghatt commented Jun 8, 2020

Hi, I seem to be facing a similar issues, I’m trying to run the following code:

I keep hitting the same error:

I am using a valid key, so I’m not too sure whats going on. Any insight would be great!

csparpa commented Jun 8, 2020

Could you pls paste here the output of a print of your OWM object instance?
That is to say:

EightFawn commented Jun 8, 2020

It gives me the same error, the output of the print of owm is:

csparpa commented Jun 8, 2020

IoI looks like there is no reason why it shouldn’t work!

Short of ideas..
Have you tried creating a new free API key and use that one instead?

EightFawn commented Jun 8, 2020

I create a new API key but I have to wait that openweathermap verify the key

EightFawn commented Jun 8, 2020

It gives the same error.

EightFawn commented Jun 8, 2020

I tried to remove the part of the weather and leave only forecast but it still not working

csparpa commented Jun 9, 2020

@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.

This behaviour was completely unexpeted to me :-S

Luckily, you’ll hopefylly be able to retrieve both observed and daily forecasted data using the
OneCall methods

EightFawn commented Jun 9, 2020

EightFawn commented Jun 11, 2020

city = list_of_locations[0][0]
TypeError: ‘Location’ object is not subscriptable

EightFawn commented Jun 13, 2020

I have to open another issue for this?

csparpa commented Jun 13, 2020

No, I’ll check this out
thanks

geofbaum commented Jun 13, 2020

@EightFawn try the following to see if you get valid lat and lon values.

@csparpa It appears that the example in the docs has an extra [0]:

As in moscow = list_of_locations[0][0] should be moscow = list_of_locations[0]. Either that or the code is returning something that isn’t expected from the Locations class.

EightFawn commented Jun 13, 2020

Yes, now it works, thanks

csparpa commented Jun 13, 2020

Ok, I’ll patch the docs then

raghuvarranvh commented Mar 5, 2021

@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.

This behaviour was completely unexpeted to me :-S

Luckily, you’ll hopefylly be able to retrieve both observed and daily forecasted data using the OneCall methods

Works like a charm.. Was stumped for a while. thanks

Источник

Как решить ошибку Invalid API Key provided pyowm?

простенький скрипт чтоб узнать погоду
решил дописать в него прогноз, полез в документацию и начал тестить,беру код оттуда, вставил свой апи ключ, и мне пишет что он не валиден.

Создал еще раз ключ, снова та же проблема

код из документации :

Простой 5 комментариев

invalid api key provided pyowm что делать. Смотреть фото invalid api key provided pyowm что делать. Смотреть картинку invalid api key provided pyowm что делать. Картинка про invalid api key provided pyowm что делать. Фото invalid api key provided pyowm что делать

invalid api key provided pyowm что делать. Смотреть фото invalid api key provided pyowm что делать. Смотреть картинку invalid api key provided pyowm что делать. Картинка про invalid api key provided pyowm что делать. Фото invalid api key provided pyowm что делать

ну проверю еще раз сейчас, может и правда

проверил, не работает всеравно.

Да что ж такое, что ему все не так

Насколько понимаю, для бесплатных ключей не все способы доступны. Например forecast нужно делать через OneCall API

invalid api key provided pyowm что делать. Смотреть фото invalid api key provided pyowm что делать. Смотреть картинку invalid api key provided pyowm что делать. Картинка про invalid api key provided pyowm что делать. Фото invalid api key provided pyowm что делать

вставил просто эту переменную и оно не пашет, как ее туда впихнуть?

тут видимо без id города надо как-то обойтись, или что?

за ответ спасибо большое, проверил все работает, но вот собственно проблема сверху

invalid api key provided pyowm что делать. Смотреть фото invalid api key provided pyowm что делать. Смотреть картинку invalid api key provided pyowm что делать. Картинка про invalid api key provided pyowm что делать. Фото invalid api key provided pyowm что делать

o5a, тогда другой вопрос, оно на русском или нет?

с каких пор Москва а конкретно «М» это не буква)

invalid api key provided pyowm что делать. Смотреть фото invalid api key provided pyowm что делать. Смотреть картинку invalid api key provided pyowm что делать. Картинка про invalid api key provided pyowm что делать. Фото invalid api key provided pyowm что делать

оно не на русском, это да

Алексей Фобиус, по поводу Киева оно наверное хочет Kyiv

Я за модулем не слежу, но по описанию видно, что при работе через OneCall запрос города понимает только английский, т.к. там по факту идет запрос к базе данных.

Но насколько вижу, можно это обойти через некие костыли: получить данные города через weather_at_place, которая понимает русские названия, а затем уже их использовать для OneCall.

invalid api key provided pyowm что делать. Смотреть фото invalid api key provided pyowm что делать. Смотреть картинку invalid api key provided pyowm что делать. Картинка про invalid api key provided pyowm что делать. Фото invalid api key provided pyowm что делать

o5a, ахахахахахха, костыли наше все

кстати да, сработало, ахаххаха

Источник

Frequently Asked QuestionsВ¶

Common fixes to common errors reported by the Community

AttributeError: ‘OWM25’ object has no attribute ‘xxx’¶

Your code looks like:

This happens because you are not running PyOWM v3 and this is because your code is currently based on an old Python 2 setup Python 2 is officially dead and should be removed in favor of Python 3.

What you should do is:

install PyOWM v3+ with pip3 install pyowm

The above snippet should just work fine then.

Remember to port the rest of your code to Python 3: everything related to PyOWM v2 can be ported using this guide

UnauthorizedError: Invalid API Key providedВ¶

You are able to successfully create an OWM object and calling functions other than One-Call related ones (eg. getting observed or forecasted weather)

As stated in the documentation home page, OpenWeatherMap API recently “blocked” calls towards a few legacy API endpoints whenever requested by clients using non-recent free API keys.

This means that PyOWM might return authorization errors in that case.

The proper way to obtain the data you are looking for is to call the “OneCall” PyOWM methods using your API key

So please refer to the documentation for this

I cannot use PyOWM 3 so I need to use PyOWM version 2.10В¶

This may happen if you still use Python 2 or you use Python 3 but with a minor version that is not supported by PyOWM

Please install PyOWM 2.10 with:

And find the PyOWM 2.10 documentation here

ModuleNotFound error upon installing PyOWM development branch from GithubВ¶

Installation of the (potentially unstable) development trunk used to be like this:

You would get something like:

I’ve realized this way of installing is bad as it does not install PyOWM’s dependencies* along. Therefore the right way to go is:

Источник

Openweathermap returns a 401 error code : Invalid API Key #3

Comments

vinpav commented Jul 25, 2018

The current version of the openweathermap neuron does not work with a free openweathermap account.

The problem comes from the «forecast = owm.daily_forecast(extended_location)» line, as the 16 days/daily forecast API calls requires a paid subscription to openweathermap (take a look at this chart for more info).

Currently a free openweathermap subscription gives only access to :

The text was updated successfully, but these errors were encountered:

Sispheor commented Jul 25, 2018

It was working, so something changed on their side recently.
I’ll take a look, thank you for the hint.

Sispheor commented Jul 25, 2018

Can you give a try by adding limit=5 to the line? So we are in free user limit ranges.

vinpav commented Jul 25, 2018 •

Sispheor commented Jul 25, 2018

OK, I’ll see with the lib owner if we have a workaround for this.
I can see that we are not using the last version. Maybe is already handled in the last version.

Sispheor commented Jul 26, 2018

Seems an issue on the API.
Do you have the same issue as this one?

vinpav commented Jul 26, 2018

Yes, it’s the same issue. But again, I don’t think this must be considered like a bug because the API response with a free account fits the price chart on the openweathermap website.
16 days/daily forecast API = http://api.openweathermap.org/data/2.5/forecast/daily = owm.daily_forecast(. ) = requires a paid subscription.
(But, I might be misunderstanding)
Anyway, I’d be happy if there’s a way to make this work with a free account 😉

Sispheor commented Jul 26, 2018

ok. I don’t see any workaround to get the «tomorrow» weather with the lib.
I’m not sure this is handled so far.

vinpav commented Jul 26, 2018

According to what I’ve seen in the API, there is a solution to get some detailed forecast information for the next 5 days.

Using the «5 days/3 hour forecast API», available with a free account, you can get the 5 next days forcast by 3 hours periods. With good python skills (which I don’t have), it might be possible to regroup all these data day by day and compute the results : day X pressure = average pressure for that day, day X min temperature = min temperature for that day, day X precipitations = sum of precipitations for that day, etc.
Though, it seems to represent a rather huge effort for a result that would probably not be fully satisfying.

Sispheor commented Jul 26, 2018

Yes, I know that it’s possible to request on the api directly. The fact is taht we are using a lib to facilitate this step.
And the idea is to stick on this lib. My question was, is the lib aware of this potential change? Do we have another call that can do the trick?
I’ll check this when I have time.

Thanks for pointing out the issue.

Sispheor commented Aug 12, 2018

Current weather and forecast ok.
Neuron updated.

vinpav commented Aug 13, 2018

Same problem with V2 update of this neuron :

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

Sispheor commented Aug 13, 2018

Show us your synapse. (Cut some letters of your key)

vinpav commented Aug 13, 2018 •

Sispheor commented Aug 13, 2018

looks good.
weird, no typo in the api key? a space or something?

daylicron commented Aug 13, 2018

I can confirm the issue.
Exception in kalliope debug log on pastebin: https://pastebin.com/5T6iZevb

I’m using up to date pyown version 2.6.1 from pip:
pip install pyowm Requirement already satisfied: pyowm in /usr/local/lib/python3.6/dist-packages (2.6.1)

Sispheor commented Aug 13, 2018

So weird, we don’t have the issue with @corus. Maybe because we have an old API key.

vinpav commented Aug 13, 2018 •

@Sispheor this is what I’ve been thinking about. Anyway, this neuron does not work for «recent» openweathermap users. Maybe you can confirm that by generating a new key / creating a new account.
I’ll switch to my previous «disappointing-current-weather-data-only» version for the moment.

Sispheor commented Aug 13, 2018

vinpav commented Aug 14, 2018

I’m using pyown 2.9.0 and I have the issue.
Run your code with a recent free API key and you’ll probably reproduce this issue.

daylicron commented Aug 14, 2018 •

I’m using pyown 2.9.0 and I have the issue.

I can confirm this. Uptdating to pyowm 2.9.0 didnt’t do the trick.

Sispheor commented Aug 15, 2018

corus87 commented Aug 15, 2018

I looked into it and I can confirm it seems related to our «old» keys. With a new key, I have the same problem.

With the function three_hours_forecast() I’m able to get a forecast of 5 days for every 3 hours and also weather_at_place() is working which is for the current weather conditions.

So we have to rebuild the neuron again, to make sure everyone gets the weather. I will try to make a PR till the end of the weekend.

Sispheor commented Aug 15, 2018

Sispheor commented Aug 19, 2018

I took a look to the update.
I just feel uncomfortable with the fact that it looks like a trick to keep having for free something that is now reserved to paid user.
@LaMonF what do you think?

daylicron commented Aug 19, 2018

I took a look to the update.
I just feel uncomfortable with the fact that it looks like a trick to keep having for free something that is now reserved to paid user.
@LaMonF what do you think?

What exactly to you mean? I checked the pricing for the OWM API and I think, things should be OK there. Take a look at the pricing. 5 days forecast and current day weather should work.

Sispheor commented Aug 19, 2018

We need to define clearly what we want to return. As the 5 days forecast is only for a 3 hour range.
How do we propose this as neuron input? The user provide the range of hours he wants?
We provide a dict of range and then the user take the one he wants in his template? We calculate the average from all range we got?

daylicron commented Aug 19, 2018

First of all I think about a switch. The user can set in the brain, if he pays for OWM or not.As default I would say, people use the free version. Using this switch we can say, that we provide the forecast the user asks for(paying users) or only the 5days/3hours forecast(free users).

Talking about what we provide for 5days/3hours forecast: How does OWM calculates the dayli forecast? I don’t know, someone who pays for OWM could find out, by comparing 5days/3 hours and dayli forecast. If they only use the max_temperature value for saying what temperature is gonna be, that should be an easy one.

But: I think it would be a nice feature to hand over the time period manually. I could imagine asking kalliope, what the weather will be in the morning. In my case this would mean: If it will be sunny/nice I’ll set my alarm 30 minutes earlier to go by bicycle to work. If it will be rainy, I’ll take the subway.

Источник

Frequently Asked Questions — pyowm documentation

Firebase, owned by Google, is currently becoming the most popular cloud-hosted NoSQL/JSON database these days and there are a ton of tutorials from blog posts to YouTube videos. You can learn the…

API key is invalid please check your subscription.

Hi team i faced an issue when i download file from any site.Error:-Original file download.API key is invalid please check your subscription.

I am working on open server environment with trial license.invalid api key provided pyowm что делать. Смотреть фото invalid api key provided pyowm что делать. Смотреть картинку invalid api key provided pyowm что делать. Картинка про invalid api key provided pyowm что делать. Фото invalid api key provided pyowm что делать

Hello I have the same problem, but I am showing that if I have a license loaded and valid for two more years. Any additional problems?

WELCOME TO THE FUTURE OF CYBER SECURITY

re-download the `GoogleService-Info.plist` file

To use Firebase in your iOS project, you first need to create a Firebase project and add your iOS app (the bundle ID) to it. Then, you’re required to add `GoogleService-Info.plist` to the iOS project and pod the Firebase frameworks.

Now, I assume you set up everything as instructed such as `FIRApp.configure()` and you’re ready to write some authentication code with Firebase using password-based accounts.

Creating a user using password-based accounts

When you run the app and you may get this error:

invalid api key provided pyowm что делать. Смотреть фото invalid api key provided pyowm что делать. Смотреть картинку invalid api key provided pyowm что делать. Картинка про invalid api key provided pyowm что делать. Фото invalid api key provided pyowm что делать

FIRAuthErrorDomain: An invalid API Key was supplied in the request. Optional(Error Domain=FIRAuthErrorDomain Code=17023 “An invalid API Key was supplied in the request.” UserInfo=)

The problem is `GoogleService-Info.plist` file doesn’t have `API_KEY` item. If you google around, you may get many answers and one of them is to set up a API key and add it to the PLIST file.

Don’t do that! You may end up with another error.

invalid api key provided pyowm что делать. Смотреть фото invalid api key provided pyowm что делать. Смотреть картинку invalid api key provided pyowm что делать. Картинка про invalid api key provided pyowm что делать. Фото invalid api key provided pyowm что делать

FIRAuthErrorDomain: An internal error has occurred, print and inspect the error details for more information. An internal error has occurred, print and inspect the error details for more information. Access Not Configured. Google Identity Toolkit API has not been used in project xxxxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/identitytoolkit/overview?project=xxxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

This is because the given API key is not from the Firebase project.

Note that it’s not Web API Key either.

To fix the issue, all you need to do is to re-download the `GoogleService-Info.plist` file and replace with the one inside your iOS project. You will see there is an `API_KEY` item in the new PLIST file.

To download the file again:

This tiny issue should be fixed at the first place. For beginners, it’s such a troublesome. However, I hope this medium is helpful.

Code snippets for Firebase using password-based accounts

If you find this medium useful, please ❤️ as much as you can!

AttributeError: ‘OWM25’ object has no attribute ‘xxx’¶

Your code looks like:

This happens because you are not running PyOWM v3 and this is because your code is currently based on an old Python 2 setupPython 2 is officially dead and should be removed in favor of Python 3.

What you should do is:

install PyOWM v3+ with pip3 install pyowm

The above snippet should just work fine then.

Remember to port the rest of your code to Python 3: everything related to PyOWM v2 can be ported using this guide

Стандартные коды ошибок:

ОшибкаЧто она означает.
unspecifiedТип ошибки не указан. Подробности смотрите в сообщении.
invalid_api_keyУказан неправильный ключ доступа к API. Проверьте, совпадает ли значение api_key со значением, указанным в личном кабинете.
access_deniedДоступ запрещён. Проверьте, включён ли доступ к API в личном кабинете и не обращаетесь ли вы к методу, прав доступа к которому у вас нет.
unknown_methodУказано неправильное имя метода.
invalid_argУказано неправильное значение одного из аргументов метода.
not_enough_moneyНе хватает денег на счету для выполнения метода.
retry_laterВременный сбой. Попробуйте ещё раз позднее.
api_call_limit_exceeded_for_api_keyСработало ограничение по вызову методов API в единицу времени. На данный момент это 1200 вызовов в минуту. Для метода sendEmail — 60.
api_call_limit_exceeded_for_ipСработало ограничение по вызову методов API в единицу времени. На данный момент это 1200 вызовов в минуту. Для метода sendEmail — 60.

UnauthorizedError: Invalid API Key provided¶

You are able to successfully create an OWM object and calling functions other than One-Call related ones (eg. getting observed or forecasted weather)

As stated in the documentation home page, OpenWeatherMap API recently “blocked” calls towards a few legacy API endpoints whenever requested by clients using non-recent free API keys.

This means that PyOWM might return authorization errors in that case.

This behaviour is not showing if you use API keys issued time ago – unfortunately I have no wasy to be more precise as OWM never stated this officially.

The proper way to obtain the data you are looking for is to call the “OneCall” PyOWM methods using your API key

So please refer to the documentation for this

I cannot use PyOWM 3 so I need to use PyOWM version 2.10¶

This may happen if you still use Python 2 or you use Python 3 but with a minor version that is not supported by PyOWM

Please install PyOWM 2.10 with:

And find the PyOWM 2.10 documentation here

ModuleNotFound error upon installing PyOWM development branch from Github¶

Installation of the (potentially unstable) development trunk used to be like this:

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *