cgoldberg / ystockquote

Fetch stock quote data from Yahoo Finance
534 stars 181 forks source link

HTTP 404 error #59

Open Richard238 opened 2 years ago

Richard238 commented 2 years ago

Getting HTTP 404 error from this module Running on Pi Zero 2W OS = Bullseye


Traceback (most recent call last):
  File "/home/pi/stockq2.py", line 3, in <module>
    print(ystockquote.get_price_book('GOOGL'))
  File "/usr/local/lib/python3.9/dist-packages/ystockquote.py", line 438, in get_price_book
    return _request(symbol, 'p6')
  File "/usr/local/lib/python3.9/dist-packages/ystockquote.py", line 32, in _request
    resp = urlopen(req)
  File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.9/urllib/request.py", line 555, in error
    result = self._call_chain(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 747, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

I wonder if perhaps, the URLs are outdated?

 url = 'http://finance.yahoo.com/d/quotes.csv?s=%s&f=%s'
 url = 'http://real-chart.finance.yahoo.com/table.csv?%s'

Thank you.