import requests from datetime import date, timedelta d1 = date(1928, 10, 1) d2 = date.today() delta = d2 - d1 s = requests.Session() print("[") for i in range(delta.days + 1): date = d1 + timedelta(i) print("((" + str(date.year) + "," + str(date.month) + "," + str(date.day) + "),", end="") url = date.strftime("http://geo.crox.net/djia/%Y/%m/%d") print("\"" + s.get(url).text + "\"),") print("]")