apify-client-python icon indicating copy to clipboard operation
apify-client-python copied to clipboard

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

Open vdusek opened this issue 1 year ago • 4 comments

It seems that the following code:

response: httpx.Response = await self.http_client.call(
    url=self._url(f'records/{key}'),
    method='GET',
    params=self._params(),
)

returns a response of type httpx.Response. Later the field _maybe_parsed_body is accessed:

return {
    'value': response._maybe_parsed_body,
    '...': '...',
}

There are 2 occurrences of this:

  • https://github.com/apify/apify-client-python/blob/v1.6.0/src/apify_client/clients/resource_clients/key_value_store.py#L120
  • https://github.com/apify/apify-client-python/blob/v1.6.0/src/apify_client/clients/resource_clients/key_value_store.py#L323

Check if http_client.call really returns a httpx.Response object and in such case fix the accessing of non-existing field _maybe_parsed_body.

vdusek avatar Nov 20 '23 11:11 vdusek