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

Fix JSON error handling #1833

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Fix JSON error handling #1833

merged 1 commit into from
Jan 19, 2024

Conversation

ange-daumal
Copy link
Contributor

Fix to prevent KeyError on 'timeseries'.

If requested symbol is incorrect/null, Yahoo Finance API returns this response :

{'finance': {'result': None, 'error': {'code': 'Not Found', 'description': 'HTTP 404 Not Found'}}} 

Hence raising a KeyError exception instead of the YFinanceException one, with an explicit error message.

You can re-create the case this PR fixes by trying an incorrect ISIN code, e.g. yf.Ticker("FR0000000000").info

@ValueRaider ValueRaider merged commit 2630c66 into ranaroussi:dev Jan 19, 2024
1 check passed
@ValueRaider ValueRaider mentioned this pull request Jan 21, 2024
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 this pull request may close these issues.

2 participants