Asynchronous HTTP API
Learn about asynchronous HTTP API in Python.
We'll cover the following
It is pretty common when writing HTTP API to return a 200 OK status code to the caller to indicate that the request succeeded. While easy and convenient, it is possible that the action triggered by the caller takes a lot of time. If the call requires a long delay to be executed, it blocks the caller as it has to wait for the reply, and this increases the risk of failure.
Indeed, if the connection lasts for too long (let’s say, a few seconds) and the network is having issues, the connection can be interrupted. In such a case, the caller has to retry the request. If that problem happens thousands of times with flaky clients, it means that tons of CPU time and network bandwidth are spent for nothing.
Get hands-on with 1400+ tech skills courses.