aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http_auth.py
diff options
context:
space:
mode:
Diffstat (limited to 'netlib/http_auth.py')
-rw-r--r--netlib/http_auth.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/netlib/http_auth.py b/netlib/http_auth.py
index 6c91c7c5..71f120d6 100644
--- a/netlib/http_auth.py
+++ b/netlib/http_auth.py
@@ -125,23 +125,19 @@ class AuthAction(Action):
"""
def __call__(self, parser, namespace, values, option_string=None):
passman = self.getPasswordManager(values)
- if passman:
- authenticator = BasicProxyAuth(passman, "mitmproxy")
- else:
- authenticator = NullProxyAuth(None)
+ authenticator = BasicProxyAuth(passman, "mitmproxy")
setattr(namespace, "authenticator", authenticator)
- def getPasswordManager(self, s):
- """
- returns the password manager
- """
+ def getPasswordManager(self, s): # pragma: nocover
raise NotImplementedError()
class SingleuserAuthAction(AuthAction):
def getPasswordManager(self, s):
if len(s.split(':')) != 2:
- raise ArgumentTypeError("Invalid single-user specification. Please use the format username:password")
+ raise ArgumentTypeError(
+ "Invalid single-user specification. Please use the format username:password"
+ )
username, password = s.split(':')
return PassManSingleUser(username, password)
@@ -154,4 +150,5 @@ class NonanonymousAuthAction(AuthAction):
class HtpasswdAuthAction(AuthAction):
def getPasswordManager(self, s):
with open(s, "r") as f:
- return PassManHtpasswd(f) \ No newline at end of file
+ return PassManHtpasswd(f)
+