Using the Climate Data Online WebAPI, every request I make fails to return January data and most of February. Only February 28th (and 29th) will be present. I've tried breaking up the data into smaller chunks, multiple stations, and I'm not bumping up against the 1000 limit. If I only request January data then I get an empty frame. I've copied other people's code, still doesn't deliver Jan & Feb. I've downloaded directly from the site and the data is there.
import requests
import json
from datetime import datetime
token = ''
headers = {'token': token}
baseUrl= r"https://www.ncdc.noaa.gov/cdo-web/api/v2/"
years=list(range(2020,2022))
for i in years:
startdate=datetime(i,1,1).date()
enddate = datetime(i,3,1).date()
url = "https://www.ncdc.noaa.gov/cdo-web/api/v2/data?" \
"datasetid=GHCND&stationid=GHCND:USW00003893&" \
"datatypeid=PRCP&" \
"units=standard&startdate={}&enddate={}&limit=1000".format(startdate,enddate)
response=requests.get(url, headers=headers)
jsonresponse = json.loads(response.text, strict=False)
This appears to be an issue with their API: no data is returned for january. I suggest raising it with them.
Your use of requests is very unidiomatic btw. The easy way would be something like:
However this doesn't return anything for january either.