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

Exceptions since last Yahoo updates #104

Open
pythonian1027 opened this issue Mar 22, 2023 · 4 comments
Open

Exceptions since last Yahoo updates #104

pythonian1027 opened this issue Mar 22, 2023 · 4 comments

Comments

@pythonian1027
Copy link

OS: Windows 10
Python version: 3.7

ticker: 'AAPL' when applicable
Exceptions per method call:

'function get_cash_flow -> Exception: "string indices must be integers"',
'function get_company_info -> Exception: "string indices must be integers"',

'function get_earnings_for_date -> Exception: "TypeError: string indices must be integers"', (case: get_earnings_for_date('02/08/2021'))
'function get_earnings_in_date_range -> returns emptyf (case: get_earnings_in_date_range('02/08/2021', '02/12/2021'))
'function get_earnings_history -> Exception: "string indices must be integers"',
'function get_financials -> Exception: "string indices must be integers"',

'function get_income_statement -> Exception: "string indices must be integers"',
'function get_next_earnings_date -> Exception: "string indices must be integers"',
'function get_top_crypto -> Exception: "KeyError: '1 Day Chart'"',
'function get_splits -> Exception: "'events'"',
'function get_stats_valuation -> Exception: "list index out of range"', , works with other tickers (e.g. NFLX)
'function tickers_ftse100 -> Exception: "AttributeError: 'DataFrame' object has no attribute 'EPIC'"',
'function tickers_ftse250 -> Exception: "ValueError: Length mismatch: Expected axis has 3 elements, new values have 2 elements"',

@dancassin
Copy link

dancassin commented Jul 13, 2023

In regards to

"'function get_earnings_history -> Exception: "string indices must be integers"',"

This looks to be an issue with change Yahoo made to its API.

If you run the function from stock_info.py:

def get_earnings_history(ticker):
        url = "https://finance.yahoo.com/calendar/earnings?symbol=" + ticker
        result = _parse_earnings_json(url)
        return result["context"]["dispatcher"]["stores"]["ScreenerResultsStore"]#["results"]["rows"]

the ["stores"] key no longer returns a dict with ["ScreenerResultsStore"] key but a string of 900,000+ characters.

I'm assuming Yahoo blocked this due to their rollout of Yahoo Finance Plus Essentials which is $30/mo

@anand-y
Copy link

anand-y commented Aug 14, 2023

@dancassin any luck for you?
i am facing similar issues with get_company_info function

ticker_symbol = "ABFRL.NS" company_info = si.get_company_info(ticker_symbol) print(company_info)

the following error i am getting

in get_company_info
json_info = json_info["assetProfile"]
TypeError: string indices must be integers

@dancassin
Copy link

I don't believe there's a way to resolve this since it is built on Yahoo! giving you the information for free. Now that the info isn't free, there's no data to extract.

@anand-y
Copy link

anand-y commented Aug 15, 2023

@dancassin thank you for replying quickly
i have managed it with yfinance for now

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

3 participants