-
Notifications
You must be signed in to change notification settings - Fork 14
refactor!: Remove parse_response arg from the call method
#462
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This refactoring removes the parse_response parameter from the call method and eliminates the _maybe_parsed_body private attribute from Response objects. The parsing functionality has been moved to a standalone utility function maybe_parse_response that is called directly where needed in the Key-Value storage client.
- Removed
parse_responseparameter from HTTP clientcallmethods - Eliminated automatic response parsing and
_maybe_parsed_bodyattribute assignment - Added
maybe_parse_responseutility function to handle response parsing explicitly where needed
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/apify_client/_http_client.py |
Removed parse_response parameter and response parsing logic from HTTP client |
src/apify_client/_utils.py |
Added new maybe_parse_response utility function for explicit response parsing |
src/apify_client/clients/resource_clients/key_value_store.py |
Updated to use new utility function instead of accessing _maybe_parsed_body |
src/apify_client/clients/resource_clients/log.py |
Removed parse_response=False parameter from calls |
src/apify_client/clients/resource_clients/dataset.py |
Removed parse_response=False parameter from calls |
tests/unit/test_client_errors.py |
Updated test calls to remove parse_response=False parameter |
vdusek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!! We should just remove the as_bytes and as_files args in a separate PR, so all these changes are documented in the changelog.
vdusek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also please describe the BCs in the upgrading guide? Similar to what we have in Crawlee and SDK, see e.g. https://crawlee.dev/python/docs/upgrading/upgrading-to-v1.
9f7b290 to
753465b
Compare
parse_response parameter for the call methodparse_response parameter from the call method
parse_response parameter from the call methodparse_response arg from the call method
vdusek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
parse_responseparameter for thecallmethod. It was only used to create the private attribute_maybe_parsed_bodyinResponse._maybe_parsed_bodyattribute has been removed; now the utility is called directly in Key-Value storage client, where it was used.Issues
_maybe_parsed_bodywithinhttpx.Responseobject #166