You use 400 here, while httplib.OK elsewhere. Having checked the rest of the code we're guilty of this in many places, but would be good to be consistent in new code. All the codes can be found here: http://docs.python.org/2/library/httplib.html