Skip to content

Conversation

@michelts
Copy link

Introduces the functions async_convert and async_poll to work in async mode.


if r.content == b'':
raise AsyncConversionInProgress

Copy link
Author

Choose a reason for hiding this comment

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

This is to solve a problem mentioned in issue #21: while the conversion is in progress, it seems the response from the server is a 202 Accepted with a blank response.

In the tests, the very first request after the async conversion has a status code 200 and blank content. The second request would have a status 202, as well as the subsequent requests until a 200 response with the expected result.

That's why I'm not testing for a 202 status code.

Copy link
Author

Choose a reason for hiding this comment

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

Notice this would raise a JSONDecodeError for any get request that doesn't have a JSON response, and I don't want to fail with an AsyncConversionInProgress error for any request. This way, I'm returning None, and only on the async_poll function I will check for the empty response and raise the exception accordingly.

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.

1 participant