algolia / algolia/algoliasearch-client-python

runtime error trying to deserialise non json responses

Open
#480 0 comments 3 reactions 0 assignees View on GitHub
Bug
Dominant language
Python
Stars
207
Forks
63
PR merge metrics
No merged PRs in 30d

Description

The Python API client throws a runtime exception while attempting to desialize a non json response. Note that, as described on the JavaScript API Client, we should **NOT** deserialise responses on those cases:

```js
isTimedOut || isNetworkError(response) || (~~(status / 100) !== 2 && ~~(status / 100) !== 4)
```

Source: https://github.com/algolia/algoliasearch-client-javascript/blob/master/packages/transporter/src/concerns/retryDecision.ts#L12.

Solution: Create a pull request that ensures that no `response.json()` is performed on the cases mentioned above.

Contributor guide

Open the contributing guide

Research direction

Start in the Python API client's response handling and compare its behavior with the linked JavaScript retryDecision.ts logic. Verify that response.json() is skipped for timeouts, network errors, and non-2xx/non-4xx statuses; done means those cases no longer raise a deserialization exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.