Conversation
e97039a to
118e8b6
Compare
|
|
||
| if r.content == b'': | ||
| raise AsyncConversionInProgress | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Introduces the functions async_convert and async_poll to work in async mode.