import itertools


def getdates(yr1=2009, yr2=2016, month1=1, month2=12, day1=1, day2=31):
	"""Returns a list of all possible dates as a set of tuples:
		E.G. date1 = (2009, 01, 01) or datex = (2011, 12, 06)
		The form is therefore a [(yyyy, mm, dd), ... (yyyy, mm, dd)]

		This function is set up to return all possible dates between 01/01/2009 and 12/31/2016. 

		It can be modified to provide expanded dates if need be.

		Note that while this creates dates that do not exist, the end result
		is simply an invalid url link, which is handled in subsequent functions."""


	years = ['2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016']
	months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
	days = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31']


	index_yr1 = yr1-2009
	index_yr2 = yr2-2009
	index_mo1 = month1-1
	index_mo2 = month2-1
	index_dy1 = day1-1
	index_dy2 = day2-1

	req_years = years[index_yr1:index_yr2+1]
	req_months = months[index_mo1:index_mo2+1]
	req_days = days[index_dy1:index_dy2+1]

	dates = (list(itertools.product(req_years, req_months, req_days)))
	return dates