Merge "recognize 429 as an rate limiting status"

This commit is contained in:
Jenkins 2013-07-26 08:40:02 +00:00 committed by Gerrit Code Review
commit ee7b01a86d

@ -148,6 +148,14 @@ class OverLimit(ClientException):
super(OverLimit, self).__init__(*args, **kwargs)
class RateLimit(OverLimit):
"""
HTTP 429 - Rate limit: you've sent too many requests for this time period.
"""
http_status = 429
message = "Rate limit"
# NotImplemented is a python keyword.
class HTTPNotImplemented(ClientException):
"""
@ -164,7 +172,8 @@ class HTTPNotImplemented(ClientException):
#
# Instead, we have to hardcode it:
_error_classes = [BadRequest, Unauthorized, Forbidden, NotFound,
MethodNotAllowed, Conflict, OverLimit, HTTPNotImplemented]
MethodNotAllowed, Conflict, OverLimit, RateLimit,
HTTPNotImplemented]
_code_map = dict((c.http_status, c) for c in _error_classes)