I have a datascience task that requires getting historical weather data. I have looked at wunderground.com but their API example is structured like so:
http://api.wunderground.com/api/d23ac65706dbf6dd/history_YYYYMMDD/q/CA/San_Francisco.json
Therefore, when attempting to build a dataset I need to get from the first day of the year to the last day of the year, but can't do that with:
20140101
20140102
20140103
...
20141229
20141230
20141231
The only thing that I can come up with is:
for m in range(1, 13):
for d in range(1, 32):
r = requests.get("http://api.wunderground.com/api/0def10027afaebb7/history_2014'+str(m)+'/'+str(d)+'/q/Mexico/Mexico_City.json")
data = r.json()
But that obviously won't work. How would you go about this in Python?