-
Notifications
You must be signed in to change notification settings - Fork 21
Async mode support #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
e97039a to
118e8b6
Compare
|
|
||
| if r.content == b'': | ||
| raise AsyncConversionInProgress | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Introduces the functions async_convert and async_poll to work in async mode.