httplib CannotSendRequest error in WSGI

This exception is raised when you reuse httplib.HTTP object for new request while you havn’t called its getresponse() method for previous request. Probably there was some other error before this one that left connection in broken state. The simplest reliable way to fix the problem is creating new connection for each request, not reusing it. Sure, it will be a bit slower, but I think it’s not an issue having you are running application in single process and single thread.

Leave a Comment