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 #1830

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Fix JSON error handling #1830

merged 1 commit into from
Jan 19, 2024

Conversation

ange-daumal
Copy link
Contributor

@ange-daumal ange-daumal commented Jan 15, 2024

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 changed the base branch from main to dev January 15, 2024 19:11
@ValueRaider
Copy link
Collaborator

Rebase to dev, is easy #1084

@ange-daumal
Copy link
Contributor Author

Rebase to dev, is easy #1084

Thanks, done :)

@ValueRaider
Copy link
Collaborator

And squash commits #1084 - unnecessarily long commit log

@ValueRaider ValueRaider merged commit 7af789f 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.

3 participants