Python: True fire-and-forget POST request without waiting for response even in separate thread

141 views Asked by At

In Python 3.10, I want to send some data to an API Server using the POST method without waiting for response. I have seen many solutions which use a separate thread to make the POST request, but my requirement is not to wait for response even in the separate thread. I want a true fire-and-forget API where I am able to send the required data to the API and close the connection immediately. Let the API take its own time to process, and let no other resource on the client side get used in processing the response (not even in separate thread).

Is this possible?

Should I use a combination of separate thread and timeout (long enough just to send the data), or are there any caveats in this approach where some requests may not reach the server? Are there any better ways without using a sub-process or threading, either in my code or in any library's code?

I am okay to use a lower level library, if it allows just sending the data without handing or waiting for the response.

0

There are 0 answers