104, ‘Connection reset by peer’ socket error, or When does closing a socket result in a RST rather than FIN?

I’ve had this problem. See The Python “Connection Reset By Peer” Problem. You have (most likely) run afoul of small timing issues based on the Python Global Interpreter Lock. You can (sometimes) correct this with a time.sleep(0.01) placed strategically. “Where?” you ask. Beats me. The idea is to provide some better thread concurrency in and … Read more

Accessing POST Data from WSGI

Assuming you are trying to get just the POST data into a FieldStorage object: # env is the environment handed to you by the WSGI server. # I am removing the query string from the env before passing it to the # FieldStorage so we only have POST data in there. post_env = env.copy() post_env[‘QUERY_STRING’] … Read more

tech