openstack/python-swiftclient — pull request #13 by rubensayshi (2014-01-31 10:38:34+00:00)
Title: Make the usage of httplib threadsafe

When using the swiftclient in a threaded environment (such as a Flask, Python app with uwsgi - not an uncommon case) the reusing of the same http_conn over multiple threads can cause issues.

I'm sometimes getting "httplib.CannotSendRequest" Exceptions, which happens when the response isn't read yet but the connection is already used to start the next request.

using threading.local() as a connection pool should prevent issues when used in a threaded environment.