Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib2.HTTPError: HTTP Error 404: Not Found #2

Open
andyyuan78 opened this issue Jul 30, 2015 · 1 comment
Open

urllib2.HTTPError: HTTP Error 404: Not Found #2

andyyuan78 opened this issue Jul 30, 2015 · 1 comment
Assignees

Comments

@andyyuan78
Copy link

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())])
~
~
~
~

@mdengler mdengler self-assigned this Aug 4, 2015
@mdengler
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants