Skip to content

Instantly share code, notes, and snippets.

@SuperMarioSF
Created December 22, 2020 08:09
Show Gist options
  • Save SuperMarioSF/072bf28703dfa4e7f09fceb6693ee402 to your computer and use it in GitHub Desktop.
Save SuperMarioSF/072bf28703dfa4e7f09fceb6693ee402 to your computer and use it in GitHub Desktop.
HTTP Status Code constants (Inspired by https://t.co/aATbyHNQaJ , unofficial codes included)
class HoldOn(object):
Continue = 100
SwitchingProtocol = 101
Processing = 102
EarlyHints = 103
Checkpoint = 103 # Unofficial: Common usage
class HereYouGo(object):
OK = 200
Created = 201
Accepted = 202
NonAuthoritativeInformation = 203
NoContent = 204
ResetContent = 205
PartialContent = 206
MultiStatus = 207
AlreadyReported = 208
ThisIsFine = 218 # Unofficial: Apache Web Server
IMUsed = 226
class GoAway(object):
MultipleChoice = 300
MovedPermanently = 301
Found = 302
SeeOther = 303
NotModified = 304
UseProxy = 305
SwitchProxy = 306
TemporaryRedirect = 307
PermanentRedirect = 308
class YouFuckedUp(object):
BadRequest = 400
Unauthorized = 401
PaymentRequired = 402
Forbidden = 403
NotFound = 404
MethodNotAllowed = 405
NotAcceptable = 406
ProxyAuthenticationRequired = 407
RequestTimedout = 408
Conflict = 409
Gone = 410
LengthRequired = 411
PreconditionFailed = 412
PayloadTooLarge = 413
URITooLong = 414
UnsupportedMediaType = 415
RangeNotSatisfiable = 416
ExpectationFailed = 417
ImATeapot = 418
PageExpired = 419 # Unofficial: Laravel Framework
MethodFailure = 420
EnhanceYourCalm = 420 # Unofficial: Twitter
MisdirectedRequest = 421
UnprocessableEntity = 422
Locked = 423
FailedDependency = 424
TooEarly = 425
UpgradeRequired = 426
PreconditionRequired = 428
TooManyRequests = 429
RequestHeaderFieldsTooLarge = 431
LoginTimeOut = 440 # Unofficial: Microsoft IIS
NoResponse = 444 # Unofficial: nginx
RetryWith = 449 # Unofficial: Microsoft IIS
BlockedByWindowsParentalControls = 450 # Unofficial: Microsoft Windows Parental Controls
UnavailableForLegalReasons = 451
Redirect = 451 # Unofficial: Microsoft IIS
RequestHeaderTooLarge = 494 # Unofficial: nginx
SSLCertificateError = 495 # Unofficial: nginx
SSLCertificateRequired = 496 # Unofficial: nginx
HTTPRequestSentToHTTPSPort = 497 # Unofficial: nginx
InvalidToken = 498 # Unofficial: Esri
TokenRequired = 499 # Unofficial: Esri
ClientClosedRequest = 499 # Unofficial: nginx
class IFuckedUp(object):
InternalServerError = 500
NotImplemented = 501
BadGateway = 502
ServiceUnavailable = 503
GatewayTimeout = 504
HTTPVersionNotSupported = 505
VariantAlsoNegotiates = 506
InsufficientStorage = 507
LoopDetected = 508
BandwidthLimitExceeded = 509 # Unofficial: Apache Web Server/cPanel
NotExtended = 510
NetworkAuthenticationRequired = 511
WebServerReturnedAnUnknownError = 520 # Unofficial: Cloudflare
WebServerIsDown = 521 # Unofficial: Cloudflare
ConnectionTimedOut = 522 # Unofficial: Cloudflare
OriginIsUnreachable = 523 # Unofficial: Cloudflare
ATimeoutOccurred = 524 # Unofficial: Cloudflare
SSLHandshakeFailed = 525 # Unofficial: Cloudflare
InvalidSSLCertificate = 526 # Unofficial: Cloudflare/Cloud Foundry
RailgunError = 527 # Unofficial: Cloudflare
SiteIsOverloaded = 529 # Unofficial: Qualys SSLLabs server
SiteIsFrozen = 530 # Unofficial: Pantheon web platform
NetworkReadTimeoutError = 598 # Unofficial: some HTTP proxies
class StatusCodes(object, HoldOn, HereYouGo, GoAway, YouFuckedUp, IFuckedUp):
# make everything together
HoldOn = HoldOn
HereYouGo = HereYouGo
GoAway = GoAway
YouFuckedUp = YouFuckedUp
IFuckedUp = IFuckedUp
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment