I need to create a small application to show some data from the Google Financial API. I know that I can study it inside out, but I have little time. The URL http://www.google.com/finance/info?q=MSFT returns this JSON string:
// [ { "id": "358464" ,"t" : "MSFT" ,"e" : "NASDAQ" ,"l" : "24.38" ,"l_cur" : "24.38" ,"ltt":"4:00PM EDT" ,"lt" : "Oct 1, 4:00PM EDT" ,"c" : "-0.11" ,"cp" : "-0.45" ,"ccol" : "chr" ,"el": "24.39" ,"el_cur": "24.39" ,"elt" : "Oct 1, 7:58PM EDT" ,"ec" : "+0.01" ,"ecp" : "0.04" ,"eccol" : "chg" ,"div" : "0.16" ,"yld" : "2.63" } ]
I do not know how to make this line available for presentation. I need to “catch” it and show (some) in my template. I need something like:
def myview(...)
URL = 'http://www.google.com/finance/info?q=MSFT'
mystring = catchfromURL(URL)
return render_to_response('page.html', mystring)
Thanks in advance.
source
share