Comments (15)
Thank you very much for reporting this. Looks like OWM has finally implemented the requirement of an API key. Since they hadn't for a long time, I don't have that fully integrated. That's not to say that that's the issue but the call you're making above is getting this in return.
&{401 Unauthorized 401 HTTP/1.1 1 1 map[Server:[nginx] Date:[Mon, 12 Oct 2015 21:41:09 GMT] Content-Type:[text/plain] Content-Length:[81] Connection:[keep-alive]] 0xc8200c40c0 81 [] false map[] 0xc8200ae000 <nil>}
When making the same call from a browser, this is the returned message:
Invalid API key. Please see http://openweathermap.org/faq#error401 for more info.
So I'm really leaning towards API key being missing being the problem.
If this is the case and there's now a requirement for the an API key, what are everyone's thoughts on impmenenting this? My immediate thought is to just look for an ENV var. Having different options might be nice but a preferred method should be agreed upon as a standard.
from openweathermap.
Ok, just received word back from OWM that they have always needed an API key but they weren't enforcing it but NOW they are. I'll try to get a fix in place soon.
from openweathermap.
@briandowns thank you for the quick response. Providing the API key as an ENV var sounds good.
from openweathermap.
Providing the API key as an ENV var is "not" good.
I think it is better to have a call that sets API keys and the following requests could use it.
Or it could be per call argument.
Parsing it from ENV is evil.
from openweathermap.
The reason I was thinking as an ENV var is because it never has to exist in the code and never has to exist in a file for the code to read providing more protection for the key. This is how it's done for AWS, for OpenStack, and for a number of other packages that require this kind of data.
My goal with now having to require a key is for it to be a set it and forget it type of thing for the user since they're not going to want to fuss with their key all the time, nor do I want to have it getting in the way of the functionality of the lib. If it's in an ENV var, it can be set as part of the base URL call and not much in the package has to change keeping backwards compatibility.
If that's just poor form, that's fine, but let's come up with solutions to keep users code from breaking if possible and keeping keys safe and secure.
from openweathermap.
Ok. That sounds good.
from openweathermap.
You seem to have a structure called Config. Are you planning to use it for all request function calls?
from openweathermap.
Yes. This is where I planned on throwing the API key once parsed from the ENV. This is also where I planned on putting the necessary data for posting weather statistics from weather stations, etc.
from openweathermap.
Ok. I have made a temporary working version with API key. Can you let me know how far you have come with your implementation? I can push a pull request, if you are in early stages.
from openweathermap.
Sure! Throw a PR up and we'll take a look.
from openweathermap.
Done. Take a look.
from openweathermap.
Also fixed test cases to report FAIL when the fetch request returns error.
from openweathermap.
@Nesurion, we should have this situated today. Apologies for the delay.
from openweathermap.
@briandowns thanks, no worries.
from openweathermap.
Resolved in #30
from openweathermap.
Related Issues (20)
- Pollution implementation seems to be out of date HOT 2
- Semantic versioning format is incorrect HOT 1
- In come cases uv index value in between 2.91 to 3.0 . HOT 1
- OpenWeather 3.0 API HOT 2
- Error upon non-existing places are unintuitive HOT 2
- Invalid data type of cod and message HOT 1
- Project being abandoned or no longer actively maintained? HOT 4
- Forecast search by zip HOT 1
- Rain and snow data missing from current? HOT 1
- [ISSUE] Error Marshaling Json Response HOT 1
- versioning is not correct for go mod HOT 3
- Add One Call API HOT 2
- Forcast5 not returning 5 day forcast HOT 2
- Requests still return invalid API key with code 401 HOT 2
- *byzip should not use int as datatype HOT 1
- UV Index API Deprecated HOT 1
- Please, change var iconUrl to "http://openweathermap.org/img/wn/%s"
- There is an error message of {"cod":"400","message":"wrong latitude"} HOT 2
- missing http part in all api urls HOT 3
- Inalid API key HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openweathermap.