From de5383d1ecd35f18d6b9ba4520019d4bd05ee320 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Fri, 23 Dec 2011 02:01:05 -0800 Subject: Add HTTP 429 "Too Many Requests" http://www.ietf.org/id/draft-nottingham-http-new-status-03.txt --- paste/httpexceptions.py | 6 ++++++ paste/wsgiwrappers.py | 1 + 2 files changed, 7 insertions(+) (limited to 'paste') diff --git a/paste/httpexceptions.py b/paste/httpexceptions.py index ede4f7e..85e7c84 100644 --- a/paste/httpexceptions.py +++ b/paste/httpexceptions.py @@ -58,6 +58,7 @@ Exception * 415 - HTTPUnsupportedMediaType * 416 - HTTPRequestRangeNotSatisfiable * 417 - HTTPExpectationFailed + * 429 - HTTPTooManyRequests HTTPServerError * 500 - HTTPInternalServerError * 501 - HTTPNotImplemented @@ -525,6 +526,11 @@ class HTTPExpectationFailed(HTTPClientError): title = 'Expectation Failed' explanation = ('Expectation failed.') +class HTTPTooManyRequests(HTTPClientError): + code = 429 + title = 'Too Many Requests' + explanation = ('The client has sent too many requests to the server.') + # # 5xx Server Error # diff --git a/paste/wsgiwrappers.py b/paste/wsgiwrappers.py index 7821d26..64f20cf 100644 --- a/paste/wsgiwrappers.py +++ b/paste/wsgiwrappers.py @@ -572,6 +572,7 @@ STATUS_CODE_TEXT = { 415: 'UNSUPPORTED MEDIA TYPE', 416: 'REQUESTED RANGE NOT SATISFIABLE', 417: 'EXPECTATION FAILED', + 429: 'TOO MANY REQUESTS', 500: 'INTERNAL SERVER ERROR', 501: 'NOT IMPLEMENTED', 502: 'BAD GATEWAY', -- cgit v1.2.1