this will help Unless you go to lengths to prevent it, IO will always block. Although you can do asynchronous requests, you will have to make you entire program async-friendly. Async does not magically make your code non-blocking. It would be much easier to do the request in another thread or process if you don't want to block your main loop.
Python HTTPConnection file send with httplib, retrieving progress
By : Kasan Francis
Date : March 29 2020, 07:55 AM
it helps some times It turns out that the poster library has a callback hook in multipart_encode, which can be used to get the progress out (upload or download). Good stuff... Although i suppose I technically answered this question, I'm sure there are other ways to skin this cat, so i'll post more if I find other methods or details for this.
it should still fix some issue If you leave it out of the constructor, how will the other methods know where to send their messages? The address/name of the server you're connecting to is the parameter for the HTTPConnection, the URI on that server is what goes into request.
may help you . Since App Engine's httplib is simply wrapped around their own urlfetch, I'm wondering how to set the default urlfetch timeout to the allowed maximum 10 seconds so that it will affect httplib.HTTPConnection. , Have you tried changing the default urlfetch deadline?
To fix this issue I think you first need to decide the failure mode you want to handle. For instance, did the connection reset because of a temporary resource problem on the server and a quick turnaround connect will fix it? Or, is the server down or rebooting and you should abort your process? Presuming the first case, I think you are thinking along the right lines. Try something like this (note, this is not working code - it's just an example of the logic):