# Copyright 2016 Osvaldo Santana Neto <staty@osantana.me>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from . import base
from . import exceptions
from .status_map import status
[docs]@status.register
class Continue(base.Informational, base.HTTP11Mixin):
code = 100
message = "Continue"
rfcs = (
("7231", "6.2.1"),
)
[docs]@status.register
class SwitchingProtocols(base.Informational, base.HTTP11Mixin):
code = 101
message = "Switching Protocols"
rfcs = (
("7231", "6.2.2"),
)
[docs]@status.register
class Processing(base.Informational, base.WebDAVMixin):
code = 102
message = "Processing"
rfcs = (
("2518", ""),
)
[docs]@status.register
class Checkpoint(base.Informational, base.UnofficialMixin):
code = 103
message = "Checkpoint"
reference = "https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#Unofficial_codes"
[docs]@status.register
class Ok(base.Successful, base.HTTP10Mixin):
code = 200
message = "OK"
rfcs = (
("7231", "6.3.1"),
)
[docs]@status.register
class Created(base.Successful, base.HTTP10Mixin):
code = 201
message = "Created"
rfcs = (
("7231", "6.3.2"),
)
[docs]@status.register
class Accepted(base.Successful, base.HTTP10Mixin):
code = 202
message = "Accepted"
rfcs = (
("7231", "6.3.3"),
)
[docs]@status.register
class NoContent(base.Successful, base.HTTP10Mixin):
code = 204
message = "No Content"
rfcs = (
("7231", "6.3.5"),
)
[docs]@status.register
class ResetContent(base.Successful, base.HTTP11Mixin):
code = 205
message = "Reset Content"
rfcs = (
("7231", "6.3.6"),
)
[docs]@status.register
class PartialContent(base.Successful, base.HTTP11Mixin):
code = 206
message = "Partial Content"
rfcs = (
("7233", "4.1"),
)
[docs]@status.register
class MultiStatus(base.Successful, base.WebDAVMixin):
code = 207
message = "Multi-Status"
rfcs = (
("4918", ""),
)
[docs]@status.register
class AlreadyReported(base.Successful, base.WebDAVMixin):
code = 208
message = "Already Reported"
rfcs = (
("5842", ""),
)
[docs]@status.register
class IMUsed(base.Successful, base.HTTP11Mixin):
code = 226
message = "IM Used"
rfcs = (
("3229", ""),
)
[docs]@status.register
class MultipleChoices(base.Redirection, base.HTTP10Mixin):
code = 300
message = "Multiple Choices"
rfcs = (
("7231", "6.4.1"),
)
[docs]@status.register
class MovedPermanently(base.Redirection, base.HTTP10Mixin):
code = 301
message = "Moved Permanently"
rfcs = (
("7231", "6.4.2"),
)
[docs]@status.register
class Found(base.Redirection, base.HTTP11Mixin):
code = 302
message = "Found"
rfcs = (
("7231", "6.4.3"),
)
[docs]@status.register
class SeeOther(base.Redirection, base.HTTP11Mixin):
code = 303
message = "See Other"
rfcs = (
("7231", "6.4.4"),
)
[docs]@status.register
class NotModified(base.Redirection, base.HTTP11Mixin):
code = 304
message = "Not Modified"
rfcs = (
("7232", "4.1"),
)
[docs]@status.register
class UseProxy(base.Redirection, base.HTTP11Mixin):
code = 305
message = "Use Proxy"
rfcs = (
("7231", "6.4.5"),
)
[docs]@status.register
class SwitchProxy(base.Redirection, base.HTTP11Mixin):
code = 306
message = "Switch Proxy" # Unused
rfcs = (
("7231", "6.4.6"),
("draft", "1.2"),
)
[docs]@status.register
class TemporaryRedirect(base.Redirection, base.HTTP11Mixin):
code = 307
message = "Temporary Redirect"
rfcs = (
("7231", "6.4.7"),
)
[docs]@status.register
class PermanentRedirect(base.Redirection, base.HTTP11Mixin):
code = 308
message = "Permanent Redirect"
rfcs = (
("7538", ""),
)
[docs]@status.register
class BadRequest(base.ClientError, base.HTTP10Mixin):
code = 400
message = "Bad Request"
exception = exceptions.BadRequestException
rfcs = (
("7231", "6.5.1"),
)
[docs]@status.register
class Unauthorized(base.ClientError, base.HTTP10Mixin):
code = 401
message = "Unauthorized"
exception = exceptions.UnauthorizedException
rfcs = (
("7235", "3.1"),
)
[docs]@status.register
class PaymentRequired(base.ClientError, base.HTTP10Mixin):
code = 402
message = "Payment Required"
exception = exceptions.PaymentRequiredException
rfcs = (
("7231", "6.5.2"),
)
[docs]@status.register
class Forbidden(base.ClientError, base.HTTP10Mixin):
code = 403
message = "Forbidden"
exception = exceptions.ForbiddenException
rfcs = (
("7231", "6.5.3"),
)
[docs]@status.register
class NotFound(base.ClientError, base.HTTP10Mixin):
code = 404
message = "Not Found"
exception = exceptions.NotFoundException
rfcs = (
("7231", "6.5.4"),
)
[docs]@status.register
class MethodNotAllowed(base.ClientError, base.HTTP11Mixin):
code = 405
message = "Method Not Allowed"
exception = exceptions.MethodNotAllowedException
rfcs = (
("7231", "6.5.5"),
)
[docs]@status.register
class NotAcceptable(base.ClientError, base.HTTP11Mixin):
code = 406
message = "Not Acceptable"
exception = exceptions.NotAcceptableException
rfcs = (
("7231", "6.5.6"),
)
[docs]@status.register
class ProxyAuthenticationRequired(base.ClientError, base.HTTP11Mixin):
code = 407
message = "Proxy Authentication Required"
exception = exceptions.ProxyAuthenticationRequiredException
rfcs = (
("7235", "3.2"),
)
[docs]@status.register
class RequestTimeout(base.ClientError, base.HTTP11Mixin):
code = 408
message = "Request Timeout"
exception = exceptions.RequestTimeoutException
rfcs = (
("7231", "6.5.7"),
)
[docs]@status.register
class Conflict(base.ClientError, base.HTTP11Mixin):
code = 409
message = "Conflict"
exception = exceptions.ConflictException
rfcs = (
("7231", "6.5.8"),
)
[docs]@status.register
class Gone(base.ClientError, base.HTTP11Mixin):
code = 410
message = "Gone"
exception = exceptions.GoneException
rfcs = (
("7231", "6.5.9"),
)
[docs]@status.register
class LengthRequired(base.ClientError, base.HTTP11Mixin):
code = 411
message = "Length Required"
exception = exceptions.LengthRequiredException
rfcs = (
("7231", "6.5.10"),
)
[docs]@status.register
class PreconditionFailed(base.ClientError, base.HTTP11Mixin):
code = 412
message = "Precondition Failed"
exception = exceptions.PreconditionFailedException
rfcs = (
("7232", "4.2"),
("8144", "3.2"),
)
[docs]@status.register
class RangeNotSatisfiable(base.ClientError, base.HTTP11Mixin):
code = 416
message = "Range Not Satisfiable"
exception = exceptions.RangeNotSatisfiableException
rfcs = (
("7233", "4.4"),
)
[docs]@status.register
class ExpectationFailed(base.ClientError, base.HTTP11Mixin):
code = 417
message = "Expectation Failed"
exception = exceptions.ExpectationFailedException
rfcs = (
("7231", "6.5.14"),
)
[docs]@status.register
class IAmATeapot(base.ClientError, base.HTCPCP10Mixin):
code = 418
message = "I am a teapot"
exception = exceptions.IAmATeapotException
[docs]@status.register
class MethodFailure(base.ClientError, base.UnofficialMixin):
code = 420
message = "Method Failure"
exception = exceptions.MethodFailureException
reference = "Spring Framework"
[docs]@status.register
class MisdirectedRequest(base.ClientError, base.HTTP20Mixin):
code = 421
message = "Misdirected Request"
exception = exceptions.MisdirectedRequestException
rfcs = (
("7540", "9.1.2"),
)
[docs]@status.register
class UnprocessableEntity(base.ClientError, base.WebDAVMixin):
code = 422
message = "Unprocessable Entity"
exception = exceptions.UnprocessableEntityException
rfcs = (
("4918", ""),
)
[docs]@status.register
class Locked(base.ClientError, base.WebDAVMixin):
code = 423
message = "Locked"
exception = exceptions.LockedException
rfcs = (
("4918", ""),
)
[docs]@status.register
class FailedDependency(base.ClientError, base.WebDAVMixin):
code = 424
message = "Failed Dependency"
exception = exceptions.FailedDependencyException
rfcs = (
("4918", ""),
)
[docs]@status.register
class UpgradeRequired(base.ClientError, base.HTTP11Mixin):
code = 426
message = "Upgrade Required"
exception = exceptions.UpgradeRequiredException
rfcs = (
("7231", "6.5.15"),
)
[docs]@status.register
class PreconditionRequired(base.ClientError, base.HTTP11Mixin):
code = 428
message = "Precondition Required"
exception = exceptions.PreconditionRequiredException
rfcs = (
("6585", ""),
)
[docs]@status.register
class TooManyRequests(base.ClientError, base.HTTP11Mixin):
code = 429
message = "Too Many Requests"
exception = exceptions.TooManyRequestsException
rfcs = (
("6585", ""),
)
[docs]@status.register
class LoginTimeout(base.ClientError, base.IISMixin):
code = 440
message = "Login Timeout"
exception = exceptions.LoginTimeoutException
[docs]@status.register
class NoResponse(base.ClientError, base.NginxMixin):
code = 444
message = "No Response"
exception = exceptions.NoResponseException
[docs]@status.register
class RetryWith(base.ClientError, base.IISMixin):
code = 449
message = "Retry With"
exception = exceptions.RetryWithException
[docs]@status.register
class BlockedByWindowsParentalControls(base.ClientError, base.UnofficialMixin):
code = 450
message = "Blocked By Windows Parental Controls"
reference = "Microsoft"
exception = exceptions.BlockedByWindowsParentalControlsException
[docs]@status.register
class UnavailableForLegalReasons(base.ClientError, base.HTTP11Mixin):
code = 451
message = "Unavailable For Legal Reasons"
exception = exceptions.UnavailableForLegalReasonsException
rfcs = (
("7725", ""),
)
[docs]class Redirect(base.ClientError, base.IISMixin):
code = 451
message = "Redirect"
exception = exceptions.BadGatewayException
[docs]@status.register
class SSLCertificateError(base.ClientError, base.NginxMixin):
code = 495
message = "SSL Certificate Error"
exception = exceptions.SSLCertificateErrorException
[docs]@status.register
class SSLCertificateRequired(base.ClientError, base.NginxMixin):
code = 496
message = "SSL Certificate Required"
exception = exceptions.SSLCertificateRequiredException
[docs]@status.register
class HTTPRequestSentToHTTPSPort(base.ClientError, base.NginxMixin):
code = 497
message = "HTTP Request Sent To HTTPS Port"
exception = exceptions.HTTPRequestSentToHTTPSPortException
[docs]@status.register
class InvalidToken(base.ClientError, base.UnofficialMixin):
code = 498
message = "Invalid Token"
reference = "ArcGIS for Server"
exception = exceptions.InvalidTokenException
[docs]@status.register
class ClientClosedRequest(base.ClientError, base.NginxMixin):
code = 499
message = "Client Closed Request"
exception = exceptions.ClientClosedRequestException
[docs]class RequestHasBeenForbiddenByAntivirus(base.ClientError, base.UnofficialMixin):
code = 499
message = "Request Has Been Forbidden By Antivirus"
reference = "https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#Unofficial_codes"
exception = exceptions.RequestHasBeenForbiddenByAntivirusException
[docs]class TokenRequired(base.ClientError, base.UnofficialMixin):
code = 499
message = "Token Required"
reference = "ArcGIS for Server"
exception = exceptions.TokenRequiredException
[docs]@status.register
class InternalServerError(base.ServerError, base.HTTP10Mixin):
code = 500
message = "Internal Server Error"
exception = exceptions.InternalServerErrorException
rfcs = (
("7231", "6.6.1"),
)
# noinspection PyShadowingBuiltins
[docs]@status.register
class NotImplemented(base.ServerError, base.HTTP10Mixin):
code = 501
message = "Not Implemented"
exception = exceptions.NotImplementedException
rfcs = (
("7231", "6.6.2"),
)
[docs]@status.register
class BadGateway(base.ServerError, base.HTTP10Mixin):
code = 502
message = "Bad Gateway"
exception = exceptions.BadGatewayException
rfcs = (
("7231", "6.6.3"),
)
[docs]@status.register
class ServiceUnavailable(base.ServerError, base.HTTP10Mixin):
code = 503
message = "Service Unavailable"
exception = exceptions.ServiceUnavailableException
rfcs = (
("7231", "6.6.4"),
)
[docs]@status.register
class GatewayTimeout(base.ServerError, base.HTTP11Mixin):
code = 504
message = "Gateway Timeout"
exception = exceptions.GatewayTimeoutException
rfcs = (
("7231", "6.6.5"),
)
[docs]@status.register
class HTTPVersionNotSupported(base.ServerError, base.HTTP11Mixin):
code = 505
message = "HTTP Version Not Supported"
exception = exceptions.HTTPVersionNotSupportedException
rfcs = (
("7231", "6.6.6"),
)
[docs]@status.register
class VariantAlsoNegotiates(base.ServerError, base.HTTP11Mixin):
code = 506
message = "Variant Also Negotiates"
exception = exceptions.VariantAlsoNegotiatesException
rfcs = (
("2295", ""),
)
[docs]@status.register
class InsufficientStorage(base.ServerError, base.WebDAVMixin):
code = 507
message = "Insufficient Storage"
exception = exceptions.InsufficientStorageException
rfcs = (
("4918", ""),
)
[docs]@status.register
class LoopDetected(base.ServerError, base.WebDAVMixin):
code = 508
message = "Loop Detected"
exception = exceptions.LoopDetectedException
rfcs = (
("5842", ""),
)
[docs]class BandwidthLimitExceeded(base.ServerError, base.UnofficialMixin):
code = 509
message = "Bandwidth Limit Exceeded"
reference = "Apache Web Server/cPanel"
exception = exceptions.BandwidthLimitExceededException
[docs]@status.register
class NotExtended(base.ServerError, base.HTTP11Mixin):
code = 510
message = "Not Extended"
exception = exceptions.NotExtendedException
rfcs = (
("2774", ""),
)
[docs]@status.register
class NetworkAuthenticationRequired(base.ServerError, base.HTTP11Mixin):
code = 511
message = "Network Authentication Required"
exception = exceptions.NetworkAuthenticationRequiredException
rfcs = (
("6585", ""),
)
[docs]@status.register
class UnknownError(base.ServerError, base.CloudflareMixin):
code = 520
message = "Unknown Error"
exception = exceptions.UnknownErrorException
[docs]@status.register
class WebServerIsDown(base.ServerError, base.CloudflareMixin):
code = 521
message = "Web Server Is Down"
exception = exceptions.WebServerIsDownException
[docs]@status.register
class ConnectionTimedOut(base.ServerError, base.CloudflareMixin):
code = 522
message = "Connection Timed Out"
exception = exceptions.ConnectionTimedOutException
[docs]@status.register
class OriginIsUnreachable(base.ServerError, base.CloudflareMixin):
code = 523
message = "Origin Is Unreachable"
exception = exceptions.OriginIsUnreachableException
[docs]@status.register
class ATimeoutOccurred(base.ServerError, base.CloudflareMixin):
code = 524
message = "A Timeout Occurred"
exception = exceptions.ATimeoutOccurredException
[docs]@status.register
class SSLHandshakeFailed(base.ServerError, base.CloudflareMixin):
code = 525
message = "SSL Handshake Failed"
exception = exceptions.SSLHandshakeFailedException
[docs]@status.register
class InvalidSSLCertificate(base.ServerError, base.CloudflareMixin):
code = 526
message = "Invalid SSL Certificate"
exception = exceptions.InvalidSSLCertificateException
[docs]@status.register
class SiteIsFrozen(base.ServerError, base.UnofficialMixin):
code = 530
message = "Site Is Frozen"
reference = "Pantheon"
exception = exceptions.SiteIsFrozenException