update
This commit is contained in:
41
httplib/exceptions.py
Normal file
41
httplib/exceptions.py
Normal file
@@ -0,0 +1,41 @@
|
||||
class HTTPException(Exception):
|
||||
""" Base class for HTTP exceptions """
|
||||
|
||||
|
||||
class InvalidResponse(HTTPException):
|
||||
""" Response message cannot be parsed """
|
||||
|
||||
def __init(self, message):
|
||||
self.message = message
|
||||
|
||||
|
||||
class InvalidStatusLine(HTTPException):
|
||||
""" Response status line is invalid """
|
||||
|
||||
def __init(self, line):
|
||||
self.line = line
|
||||
|
||||
|
||||
class UnsupportedEncoding(HTTPException):
|
||||
""" Reponse Encoding not support """
|
||||
|
||||
def __init(self, enc_type, encoding):
|
||||
self.enc_type = enc_type
|
||||
self.encoding = encoding
|
||||
|
||||
|
||||
class IncompleteResponse(HTTPException):
|
||||
def __init(self, cause):
|
||||
self.cause = cause
|
||||
|
||||
class HTTPServerException(Exception):
|
||||
""" Base class for HTTP Server exceptions """
|
||||
|
||||
|
||||
class BadRequest(HTTPServerException):
|
||||
""" Malformed HTTP request"""
|
||||
|
||||
class MethodNotAllowed(HTTPServerException):
|
||||
""" Method is not allowed """
|
||||
def __init(self, allowed_methods):
|
||||
self.allowed_methods = allowed_methods
|
Reference in New Issue
Block a user