Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
general :class:`HTTPError` class will be returned.
:type response: :class:`bravado_core.response.IncomingResponse`
:param message: Optional string message
:param swagger_result: If the response for this HTTPError is
documented in the swagger spec, then this should be the result
value of the response.
:return: An HTTP exception class that can be raised
"""
status_code = response.status_code
exc_class = status_map.get(status_code)
if exc_class is None:
exception_families = {
300: HTTPRedirection,
400: HTTPClientError,
500: HTTPServerError,
}
exc_class = exception_families.get(
(status_code // 100) * 100,
) or HTTPError
return exc_class(response, message=message, swagger_result=swagger_result)
class HTTPRequestHeaderFieldsTooLarge(HTTPClientError):
"""HTTP/431 - Request Header Fields Too Large"""
status_code = 431
class HTTPUnavailableForLegalReasons(HTTPClientError):
"""HTTP/451 - Unavailable For Legal Reasons"""
status_code = 451
class HTTPInternalServerError(HTTPServerError):
"""HTTP/500 - Internal Server Error"""
status_code = 500
class HTTPNotImplemented(HTTPServerError):
"""HTTP/501 - Not Implemented"""
status_code = 501
class HTTPBadGateway(HTTPServerError):
"""HTTP/502 - Bad Gateway"""
status_code = 502
class HTTPServiceUnavailable(HTTPServerError):
"""HTTP/503 - Service Unavailable"""
status_code = 503
class HTTPGatewayTimeout(HTTPServerError):
"""HTTP/504 - Gateway Timeout"""
status_code = 428
class HTTPTooManyRequests(HTTPClientError):
status_code = 429
class HTTPRequestHeaderFieldsTooLarge(HTTPClientError):
status_code = 431
class HTTPUnavailableForLegalReasons(HTTPClientError):
status_code = 451
class HTTPInternalServerError(HTTPServerError):
status_code = 500
class HTTPNotImplemented(HTTPServerError):
status_code = 501
class HTTPBadGateway(HTTPServerError):
status_code = 502
class HTTPServiceUnavailable(HTTPServerError):
status_code = 503
class HTTPGatewayTimeout(HTTPServerError):
class HTTPVariantAlsoNegotiates(HTTPServerError):
"""HTTP/506 - Variant Also Negotiates"""
status_code = 506
class HTTPInsufficientStorage(HTTPServerError):
"""HTTP/507 - Insufficient Storage"""
status_code = 507
class HTTPLoopDetected(HTTPServerError):
"""HTTP/508 - Loop Detected"""
status_code = 508
class HTTPNotExtended(HTTPServerError):
"""HTTP/510 - Not Extended"""
status_code = 510
class HTTPNetworkAuthenticationRequired(HTTPServerError):
"""HTTP/511 - Network Authentication Required"""
status_code = 511
class BravadoTimeoutError(base_timeout_error):
pass
class BravadoConnectionError(base_connection_error):
pass
status_code = 502
class HTTPServiceUnavailable(HTTPServerError):
status_code = 503
class HTTPGatewayTimeout(HTTPServerError):
status_code = 504
class HTTPHTTPVersionNotSupported(HTTPServerError):
status_code = 505
class HTTPVariantAlsoNegotiates(HTTPServerError):
status_code = 506
class HTTPInsufficientStorage(HTTPServerError):
status_code = 507
class HTTPLoopDetected(HTTPServerError):
status_code = 508
class HTTPNotExtended(HTTPServerError):
status_code = 510
class HTTPNetworkAuthenticationRequired(HTTPServerError):
status_code = 504
class HTTPHTTPVersionNotSupported(HTTPServerError):
status_code = 505
class HTTPVariantAlsoNegotiates(HTTPServerError):
status_code = 506
class HTTPInsufficientStorage(HTTPServerError):
status_code = 507
class HTTPLoopDetected(HTTPServerError):
status_code = 508
class HTTPNotExtended(HTTPServerError):
status_code = 510
class HTTPNetworkAuthenticationRequired(HTTPServerError):
status_code = 511
class HTTPInternalServerError(HTTPServerError):
"""HTTP/500 - Internal Server Error"""
status_code = 500
class HTTPNotImplemented(HTTPServerError):
"""HTTP/501 - Not Implemented"""
status_code = 501
class HTTPBadGateway(HTTPServerError):
"""HTTP/502 - Bad Gateway"""
status_code = 502
class HTTPServiceUnavailable(HTTPServerError):
"""HTTP/503 - Service Unavailable"""
status_code = 503
class HTTPGatewayTimeout(HTTPServerError):
"""HTTP/504 - Gateway Timeout"""
status_code = 504
class HTTPHTTPVersionNotSupported(HTTPServerError):
"""HTTP/505 - HTTP Version Not Supported"""
status_code = 505
class HTTPVariantAlsoNegotiates(HTTPServerError):
"""HTTP/506 - Variant Also Negotiates"""
class HTTPBadGateway(HTTPServerError):
"""HTTP/502 - Bad Gateway"""
status_code = 502
class HTTPServiceUnavailable(HTTPServerError):
"""HTTP/503 - Service Unavailable"""
status_code = 503
class HTTPGatewayTimeout(HTTPServerError):
"""HTTP/504 - Gateway Timeout"""
status_code = 504
class HTTPHTTPVersionNotSupported(HTTPServerError):
"""HTTP/505 - HTTP Version Not Supported"""
status_code = 505
class HTTPVariantAlsoNegotiates(HTTPServerError):
"""HTTP/506 - Variant Also Negotiates"""
status_code = 506
class HTTPInsufficientStorage(HTTPServerError):
"""HTTP/507 - Insufficient Storage"""
status_code = 507
class HTTPLoopDetected(HTTPServerError):
"""HTTP/508 - Loop Detected"""
status_code = 429
class HTTPRequestHeaderFieldsTooLarge(HTTPClientError):
status_code = 431
class HTTPUnavailableForLegalReasons(HTTPClientError):
status_code = 451
class HTTPInternalServerError(HTTPServerError):
status_code = 500
class HTTPNotImplemented(HTTPServerError):
status_code = 501
class HTTPBadGateway(HTTPServerError):
status_code = 502
class HTTPServiceUnavailable(HTTPServerError):
status_code = 503
class HTTPGatewayTimeout(HTTPServerError):
status_code = 504
class HTTPHTTPVersionNotSupported(HTTPServerError):
status_code = 501
class HTTPBadGateway(HTTPServerError):
status_code = 502
class HTTPServiceUnavailable(HTTPServerError):
status_code = 503
class HTTPGatewayTimeout(HTTPServerError):
status_code = 504
class HTTPHTTPVersionNotSupported(HTTPServerError):
status_code = 505
class HTTPVariantAlsoNegotiates(HTTPServerError):
status_code = 506
class HTTPInsufficientStorage(HTTPServerError):
status_code = 507
class HTTPLoopDetected(HTTPServerError):
status_code = 508
class HTTPNotExtended(HTTPServerError):