Skip to content

Conversation

Mantisus
Copy link
Collaborator

  • Remove the parse_response parameter for the call method. It was only used to create the private attribute _maybe_parsed_body in Response.
  • The _maybe_parsed_body attribute has been removed; now the utility is called directly in Key-Value storage client, where it was used.

Issues

Copy link

@Copilot Copilot AI left a 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_response parameter from HTTP client call methods
  • Eliminated automatic response parsing and _maybe_parsed_body attribute assignment
  • Added maybe_parse_response utility 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

@Mantisus Mantisus had a problem deploying to fork-pr-integration-tests August 12, 2025 13:14 — with GitHub Actions Failure
@Mantisus Mantisus self-assigned this Aug 12, 2025
@Mantisus Mantisus had a problem deploying to fork-pr-integration-tests August 12, 2025 13:33 — with GitHub Actions Failure
Copy link
Contributor

@vdusek vdusek left a 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.

Copy link
Contributor

@vdusek vdusek left a 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.

@Mantisus Mantisus had a problem deploying to fork-pr-integration-tests August 12, 2025 16:14 — with GitHub Actions Failure
@Mantisus Mantisus changed the title refactor!: Remove the parse_response parameter for the call method refactor!: Remove the parse_response parameter from the call method Aug 12, 2025
@vdusek vdusek changed the title refactor!: Remove the parse_response parameter from the call method refactor!: Remove parse_response arg from the call method Aug 13, 2025
Copy link
Contributor

@vdusek vdusek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mantisus Mantisus had a problem deploying to fork-pr-integration-tests August 13, 2025 11:38 — with GitHub Actions Failure
@Mantisus Mantisus had a problem deploying to fork-pr-integration-tests August 13, 2025 11:53 — with GitHub Actions Failure
@vdusek vdusek merged commit 840d51a into apify:master Aug 13, 2025
26 of 27 checks passed
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.

Address accessing of non-existing field _maybe_parsed_body within httpx.Response object
2 participants