yahoo_financials.get_key_statistics_data() TypeError: string indices must be integers
See original GitHub issueyahoo_financials.get_key_statistics_data(), Suddenly started throwing error: TypeError: string indices must be integers. Not sure anybody using this python module experiencing the error.
`from yahoofinancials import YahooFinancials
ticker = ‘AAPL’ yahoo_financials = YahooFinancials(ticker)
conentKeys = yahoo_financials.get_key_statistics_data()
Traceback (most recent call last):
File “/Users/raj/opt/miniconda3/lib/python3.8/runpy.py”, line 194, in _run_module_as_main return _run_code(code, main_globals, None, File “/Users/raj/opt/miniconda3/lib/python3.8/runpy.py”, line 87, in _run_code exec(code, run_globals) File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/…/…/debugpy/launcher/…/…/debugpy/main.py”, line 39, in <module> cli.main() File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/…/…/debugpy/launcher/…/…/debugpy/…/debugpy/server/cli.py”, line 430, in main run() File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/…/…/debugpy/launcher/…/…/debugpy/…/debugpy/server/cli.py”, line 284, in run_file runpy.run_path(target, run_name=“main”) File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py”, line 321, in run_path return _run_module_code(code, init_globals, run_name, File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py”, line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File “/Users/raj/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py”, line 124, in _run_code exec(code, run_globals) File “/Users/raj/Code/Machine_Learning/wb-starter/scrap_yahoo_finance3.py”, line 7, in <module> conentKeys = yahoo_financials.get_key_statistics_data() File “/Users/raj/opt/miniconda3/lib/python3.8/site-packages/yahoofinancials/init.py”, line 613, in get_key_statistics_data return self.get_clean_data(self.get_stock_tech_data(‘defaultKeyStatistics’), ‘defaultKeyStatistics’) File “/Users/raj/opt/miniconda3/lib/python3.8/site-packages/yahoofinancials/init.py”, line 492, in get_stock_tech_data return self.get_stock_data(statement_type=‘keystats’, tech_type=tech_type) File “/Users/raj/opt/miniconda3/lib/python3.8/site-packages/yahoofinancials/init.py”, line 476, in get_stock_data dict_ent = self._create_dict_ent(self.ticker, statement_type, tech_type, report_name, hist_obj) File “/Users/raj/opt/miniconda3/lib/python3.8/site-packages/yahoofinancials/init.py”, line 409, in _create_dict_ent re_data = self._scrape_data(YAHOO_URL, tech_type, statement_type) File “/Users/raj/opt/miniconda3/lib/python3.8/site-packages/yahoofinancials/init.py”, line 169, in _scrape_data stores = data[“context”][“dispatcher”][“stores”][“QuoteSummaryStore”][tech_type] TypeError: string indices must be integers `
Issue Analytics
- State:
- Created 9 months ago
- Comments:9
I have created a pull request with the fix hopefully it will be accepted too. I found the fix on a separate package: https://github.com/ranaroussi/yfinance/pull/1253/commits/8e5f0984af347afda6be74b27a989422e49a975b
I also get the same issue using yahoo_financials.get_current_price() method. Any update on this issue?