Open andyyuan78 opened 9 years ago
Do you still have this issue? It seems to work for me again:
$ cat ./stockquotetest.py
#!/usr/bin/env python
import stockquote, os
h = list(stockquote.historical_quotes("GOOG", "20010101", "20101231"))
print os.linesep.join(["%25s: %s" % (k, h[0][k]) for k in sorted(h[0].keys())])
q = stockquote.from_google("GOOG")
print os.linesep.join(["%25s: %s" % (k, q[k]) for k in sorted(q.keys())])
$ ./stockquotetest.py
Adj Close: 296.688813
Close: 593.971003
Date: 2010-12-31
High: 598.421039
Low: 592.031016
Open: 596.740995
Volume: 3090000
source: Yahoo!
source_url: http://ichart.yahoo.com/table.csv?s=GOOG&d=11&e=31&f=2010&a=0&b=1&c=2001&g=d&ignore=.csv
symbol: GOOG
GOOGLE_CODE_c_fix: -0.31
GOOGLE_CODE_ccol: chr
GOOGLE_CODE_cp_fix: -0.04
GOOGLE_CODE_id: 304466804484872
GOOGLE_CODE_l_cur: 786.90
GOOGLE_CODE_l_fix: 786.90
GOOGLE_CODE_lt_dts: 2016-09-23T16:00:02Z
GOOGLE_CODE_pcls_fix: 787.21
GOOGLE_CODE_s: 0
change: -0.31
exchange: NASDAQ
price_close: -0.04
price_last: 786.90
price_last_datetime: Sep 23, 4:00PM EDT
price_last_time: 4:00PM EDT
source: Google
source_url: http://www.google.com/finance/info?q=GOOG
symbol: GOOG
ubgpu@ubgpu:~/github/stockquote$ ubgpu@ubgpu:~/github/stockquote$ python test.py Traceback (most recent call last): File "test.py", line 3, in
h = list(stockquote.historical_quotes("GOOG", "20010101", "20101231"))
File "/home/ubgpu/github/stockquote/stockquote.py", line 425, in historical_quotes
lines = urllib2.urlopen(url).readlines()
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 448, in error
return self._call_chain(_args)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(_args)
File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
ubgpu@ubgpu:~/github/stockquote$
import stockquote, os
h = list(stockquote.historical_quotes("GOOG", "20010101", "20101231")) print os.linesep.join(["%25s: %s" % (k, h[0][k]) for k in sorted(h[0].keys())])
q = stockquote.from_google("GOOG") print os.linesep.join(["%25s: %s" % (k, q[k]) for k in sorted(q.keys())]) ~ ~ ~ ~