refactor!: Remove parse_response arg from the call method#462
refactor!: Remove parse_response arg from the call method#462vdusek merged 3 commits intoapify:masterfrom
parse_response arg from the call method#462Conversation
There was a problem hiding this comment.
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.
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.
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
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