Skip to content

Unable to fetch stock data from yahoo! #995

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

Open
vikassnwl opened this issue Aug 25, 2024 · 2 comments
Open

Unable to fetch stock data from yahoo! #995

vikassnwl opened this issue Aug 25, 2024 · 2 comments

Comments

@vikassnwl
Copy link

Run the following code to reproduce the issue:

import pandas_datareader as web
web.DataReader("AAPL", "yahoo", "1/1/2018", "1/1/2019")

You will get the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vikas/.local/lib/python3.8/site-packages/pandas/util/_decorators.py", line 210, in wrapper
    return func(*args, **kwargs)
  File "/home/vikas/.local/lib/python3.8/site-packages/pandas_datareader/data.py", line 370, in DataReader
    return YahooDailyReader(
  File "/home/vikas/.local/lib/python3.8/site-packages/pandas_datareader/base.py", line 253, in read
    df = self._read_one_data(self.url, params=self._get_params(self.symbols))
  File "/home/vikas/.local/lib/python3.8/site-packages/pandas_datareader/yahoo/daily.py", line 152, in _read_one_data
    j = json.loads(re.search(ptrn, resp.text, re.DOTALL).group(1))
AttributeError: 'NoneType' object has no attribute 'group'
@r-vvch
Copy link

r-vvch commented Sep 16, 2024

Same issue

@Quelconque
Copy link

Problem seem to be caused by this code snippet (at line 149 in yahoo/daily.py):
try:
j = json.loads(re.search(ptrn, resp.text, re.DOTALL).group(1))
data = j["context"]["dispatcher"]["stores"]["HistoricalPriceStore"]
except KeyError as exc:
msg = "No data fetched for symbol {} using {}"
raise RemoteDataError(msg.format(symbol, self.class.name)) from exc

if pattern is not found, re.search() returns None while the programmer was expecting a KeyError exception.

Nobody fixed the problem in the last 8 months.
Is there still a pilot on this plane?

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

Successfully merging a pull request may close this issue.

3 participants