However, I don’t understand how to modify this to get a range of observations by passing things like the “obs_air”, “day_offset”, “time_start”, “time_end”, and “format” parameters. Could someone please advise or provide an example?
You can pass the extra parameters as query string parameters in the URL. That is you pass them after the ? in the URL (token is a query string parameter as well), and you separate them with an ampersand. For example, you can use time_start and time_end like:
OK - still having problems. I can get the station status information but when I try to retrieve the observations I am getting an authorization error. The command works the api webpage but not from my python script. Advice appreciated! Code below.
As Eric said the URL you are using in requests.get is missing the token= parameter. Follow Eric’s instructions to get a token and then add this into the URL. You may also want to change the format=csv parameter as I have no idea how requests will deal with this option. It might work fine, so feel free to ignore
Thanks guys! I ended up authenticating using the cURL command provided in the API webpage and things seem to work OK now. Seems like the format-csv parameter works OK. Now to figure out how to get the resulting mess into a pandas dataframe. (The idea of dumping the observations into a series of Google Sheets documents using the IFTTT initially sounded messy, but is sounding better now. This whole process seems more complicated than it should be (at least for me)…