The original poster stated that they do not understand why it hangs, but they also wanted urllib.request.urlopen not to hang. I can’t say how to keep him from hanging, but if it helps someone, then why can he hang.
The Python-urllib/3.6 client Python-urllib/3.6 picky. He expects, for example, that the server will return HTTP/1.1 200 OK not HTTP 200 OK . It also expects the server to close the connection when it sends connection: close to the headers.
The best way to diagnose this is to get the original result of the server’s response and compare it with another server’s response, which, as you know, works. Then, if you must create a server and process the response to determine exactly what the difference is. Perhaps this can lead to at least a change on the server and allow it to not hang.
source share