A few questions regarding how to use this API #229
Replies: 5 comments
-
It looks like you are using python and the requests module. That is what I am using and have not run into the SSL issue you mentioned. Nor have I included an API key (though I hear that is coming eventually). I tried just what you did and it worked for me (python 3.8.6).
I also looked at the skyCover, and got what look like decent results
Are you still having issues? If not, perhaps there was some sort of outage earlier. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help @jfbauer432 ! Yes I'm still having the issues, I've been having the issues for a few days. I'm using python 3.9 64bit in PyCharm. Probably I should try another IDE if the code is working for you? The errors I got, more specifically, looks like this: It's thrown when running this line: |
Beta Was this translation helpful? Give feedback.
-
I don't know anything about PyCharm, but I verified that python 3.9.2 also works for me. I am suspecting you might be picking up old or bad certificates. Looks like requests, uses module certifi for the certs. You can import that and print certifi.version and see what you get. For comparison, on Ubuntu 20.10, I have 2020.04.05.1. In a python 3.9.2 docker image I get 2020.12.05. On a raspberry pi system with python 3.7.2, certifi.version is 2018.08.24. In all of those, the example I tried all worked. You can also print out certifi.where() to see where it is looking for the certs and if that file even exists on your system. If you haven't already, try a simple example to be sure nothing in you code is adversely affecting how requests is working. |
Beta Was this translation helpful? Give feedback.
-
Thanks again @jfbauer432 ! |
Beta Was this translation helpful? Give feedback.
-
The API does not require a key (yet), only a user agent header. The sky cover invalid values were due to a temporary issue with MADIS that feeds the API oberservations. I'm not familiar enough with PyCharm to know if validation is something special it's attempting to do, but I'll ask the team tomorrow that are more familiar with Python. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have a few questions regarding how to use this API.
Response = requests.get("https://api.weather.gov/points/%f,%f" % (29.3,-94.9))
I'm getting SSLCertVerificationError.
I assume we need an API key to use this service, but I haven't found anyway to create an account on the weather.gov website or how to get an API key.
I tried to add a header and include User-Agent in the header but that didn't help either.
e.g.
response = requests.get(
'https://api.weather.gov/points/30,-90',
headers={'Accept': 'application/vnd.noaa.dwml+xml', 'User-Agent': 'CERN-LineMode/2.15 libwww/2.17b3'}
)
So what am I missing?
To work around this temporarily, I turned off certificate verification:
weatherResponse: Response = requests.get(
"https://api.weather.gov/points/%f,%f" % (29.3,-94.9), verify=False)
That allows me to access the API, but of course it's not ideal. And maybe this causes another problem which I will mention below.
https://api.weather.gov/gridpoints/HGX/81,79
At the bottom of the page there is:
"stability": {
"values": []
},
Is it possible to get the Pasquill stability class from the API?
e.g.
https://api.weather.gov/gridpoints/HGX/81,79/forecast/hourly
This doesn't provide the Pasquill stability class, nor solar radiation / cloud coverage which can be used to calculate the stability class. So I need to access e.g.:
https://api.weather.gov/gridpoints/HGX/81,79/
which has a section for "skyCover". I assume that's equivalent to cloud coverage.
However when I try to access this site in my code, I'm not getting any meaningful values back for skyCover or any other variables:

Not sure whether it's because I turned off certificate verification. I am able to access /forecast and /forecast/hourly though.
Much appreciated for your help!
best regards
Beta Was this translation helpful? Give feedback.
All reactions