Before I begin, may I just say, I am very new to general communication with the web in code. With that said, could anyone assist me in getting these parameters,
'a': stMonth,
'b': stDate,
'c': stYear,
'd': enMonth,
'e': enDate,
'f': enYear,
'submit': 'submit'
meant for the "Set Date Range" box on this page, http://finance.yahoo.com/q/hp?s=gspc&a=00&b=3&c=1951&d=11&e=29&f=2014&g=d&z=66&y=0
,working in my Python code. It currently includes this:
def getHistoricData(symbol, stMonth, stDate, stYear, enMonth, enDate, enYear):
url = 'http://finance.yahoo.com/q/hp?s=%s&a=00&b=3&c=1951&d=11&e=29&f=2014&g=d&z=66&y=0' % symbol
params = {
'a': stMonth,
'b': stDate,
'c': stYear,
'd': enMonth,
'e': enDate,
'f': enYear,
'submit': 'submit',
}
response = requests.get(url, params=params)
tree = html.document_fromstring(response.content)
symbol = raw_input("Symbol: ")
getHistoricData(symbol, '00', '11', '2010', '00', '13', '2010')
I believe something may be wrong with either the names or values of the parameters, but I can't be sure. Thanks in advance - any and all help is much appreciated! (including criticism, as long as it's at least somewhat constructive!)