mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 18:31:22 +00:00
28 lines
659 B
Python
28 lines
659 B
Python
from netlib import odict
|
|
|
|
|
|
class HttpError(Exception):
|
|
|
|
def __init__(self, code, message):
|
|
super(HttpError, self).__init__(message)
|
|
self.code = code
|
|
|
|
|
|
class HttpErrorConnClosed(HttpError):
|
|
pass
|
|
|
|
|
|
class HttpAuthenticationError(Exception):
|
|
|
|
def __init__(self, auth_headers=None):
|
|
super(HttpAuthenticationError, self).__init__(
|
|
"Proxy Authentication Required"
|
|
)
|
|
if isinstance(auth_headers, dict):
|
|
auth_headers = odict.ODictCaseless(auth_headers.items())
|
|
self.headers = auth_headers
|
|
self.code = 407
|
|
|
|
def __repr__(self):
|
|
return "Proxy Authentication Required"
|