Skip to content

Instantly share code, notes, and snippets.

@sterfry1988
Created April 11, 2015 02:20
Show Gist options
  • Save sterfry1988/014c80f8a9629c7fada0 to your computer and use it in GitHub Desktop.
Save sterfry1988/014c80f8a9629c7fada0 to your computer and use it in GitHub Desktop.
import requests
from datetime import datetime
SJC_HISTORY_URL = "http://api.wunderground.com/api/api_key/history_%s/q/CA/San_Jose.json"
def makeRequests():
today = datetime.date.today()
temperatures = {}
#Start the range at 1 and go to 8 to ensure we go back 7 days.
for x in range(1,8):
request_date = (today - datetime.timedelta(days=x)).isoformat()
#Do I need to do this asynchronusly or will the loop wait for the request to complete?
request = requests.get(SJC_HISTORY_URL % request_date)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment