fix: raise HTTPError on failed API responses instead of returning None#44
Merged
EarningsCall merged 1 commit intomasterfrom Mar 11, 2026
Merged
Conversation
bdfddd8 to
ddf3d0d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
ddf3d0d to
bd04a4e
Compare
Owner
Author
|
Bugbot finding addressed: |
bd04a4e to
a97a237
Compare
Functions like get_symbols_v2(), get_sp500_companies_txt_file(), get_events(), and get_exchanges_json() silently returned the raw response on HTTP errors, causing downstream callers to crash with AttributeError when trying to use the result. Now all four use response.raise_for_status() consistently, matching the pattern already used by get_transcript() and download_audio_file(). Adds HTTPError handling to _get_events() in company.py so 404 returns [] instead of crashing (consistent with other methods). Also adds return type hints to all public functions in api.py, error-path unit tests (404/500) for all fixed functions, and fixes a missing @responses.activate decorator on an existing test. Bumps version to 2.0.1. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
a97a237 to
c8b41e9
Compare
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_symbols_v2(),get_sp500_companies_txt_file(),get_events(), andget_exchanges_json()now raiseHTTPErroron failed API responses instead of silently returning the raw response. Previously, non-200 responses were passed through to callers, which would then crash withAttributeError(e.g., calling.split()on a non-text response) or return corrupt data._get_events()inCompanynow handlesHTTPError(returns[]on 404), consistent withget_transcript(),download_audio_file(), anddownload_slide_deck().api.py@responses.activatedecorator ontest_download_audio_file_missing_params_raises_value_errorTest plan
pytest)HTTPErroris raised with correct status code in message ("500 Server Error","404 Client Error")company.events()returns[]on 404, raises on 500test_get_sp_500_companies_failed_requestupdated to expectHTTPErrorinstead of empty list🤖 Generated with Claude Code