Python, yahoo yql quote error -


i have used yql console , have received appropriate response. however, sending python based query, continue have error. first console example:

select * yahoo.finance.quotes symbol in ("yahoo", "aapl") 

i receive results block has expected fields. python example:

import requests base_url = 'https://query.yahooapis.com/v1/public/yql?' query = 'q=select * yahoo.finance.quotes symbol in ("yhoo", "aapl")' full_query=base_url + query result = requests.get(full_query) print(result.content) 

with following response:

b'\nno definition found table yahoo.finance.quotes'

what missing? tia, clayton

what missing env part of query:

import json import urllib pprint import pprint  base_url = 'https://query.yahooapis.com/v1/public/yql?' query = {     'q': 'select * yahoo.finance.quote symbol in ("yhoo","aapl")',     'format': 'json',     'env': 'store://datatables.org/alltableswithkeys' }  url = base_url + urllib.urlencode(query) response = urllib.urlopen(url) data = response.read() quote = json.loads(data) pprint(quote) 

output:

{u'query': {u'count': 2,             u'created': u'2014-12-06t03:53:23z',             u'lang': u'en-us',             u'results': {u'quote': [{u'averagedailyvolume': u'38009400',                                      u'change': u'+0.58',                                      u'dayshigh': u'51.25',                                      u'dayslow': u'50.51',                                      u'daysrange': u'50.51 - 51.25',                                      u'lasttradepriceonly': u'50.99',                                      u'marketcapitalization': u'48.305b',                                      u'name': u'yahoo! inc.',                                      u'stockexchange': u'nasdaqnm',                                      u'symbol': u'yhoo',                                      u'volume': u'15418123',                                      u'yearhigh': u'52.62',                                      u'yearlow': u'32.15',                                      u'symbol': u'yhoo'},                                     {u'averagedailyvolume': u'57049800',                                      u'change': u'-0.49',                                      u'dayshigh': u'116.08',                                      u'dayslow': u'114.64',                                      u'daysrange': u'114.64 - 116.08',                                      u'lasttradepriceonly': u'115.00',                                      u'marketcapitalization': u'674.5b',                                      u'name': u'apple inc.',                                      u'stockexchange': u'nasdaqnm',                                      u'symbol': u'aapl',                                      u'volume': u'38318896',                                      u'yearhigh': u'119.75',                                      u'yearlow': u'70.5071',                                      u'symbol': u'aapl'}]}}} 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -