diff options
author | kira0204 <rshtmudgal@gmail.com> | 2018-03-06 05:44:05 +0530 |
---|---|---|
committer | kira0204 <rshtmudgal@gmail.com> | 2018-03-06 05:44:05 +0530 |
commit | be50f3f4810c70e0050a17cefee6a69bdc76e271 (patch) | |
tree | 453923ac21e68a71ecb1b17834a99886259c4d91 /mitmproxy/command.py | |
parent | c6802ba034d859a914bebddaa9e3214e15206d0e (diff) | |
download | mitmproxy-be50f3f4810c70e0050a17cefee6a69bdc76e271.tar.gz mitmproxy-be50f3f4810c70e0050a17cefee6a69bdc76e271.tar.bz2 mitmproxy-be50f3f4810c70e0050a17cefee6a69bdc76e271.zip |
wrong additions
test-for-2850
few fixes
mock testing
Typo error
Diffstat (limited to 'mitmproxy/command.py')
-rw-r--r-- | mitmproxy/command.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mitmproxy/command.py b/mitmproxy/command.py index 45141576..114e882d 100644 --- a/mitmproxy/command.py +++ b/mitmproxy/command.py @@ -1,5 +1,5 @@ """ - This module manges and invokes typed commands. + This module manages and invokes typed commands. """ import inspect import types @@ -131,8 +131,13 @@ class CommandManager(mitmproxy.types._CommandBase): for i in dir(addon): if not i.startswith("__"): o = getattr(addon, i) - if hasattr(o, "command_path"): - self.add(o.command_path, o) + try: + is_command = hasattr(o, "command_path") + except Exception: + pass # hasattr may raise if o implements __getattr__. + else: + if is_command: + self.add(o.command_path, o) def add(self, path: str, func: typing.Callable): self.commands[path] = Command(self, path, func) |