aboutsummaryrefslogtreecommitdiffstats
path: root/examples/addons/commands-simple.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/addons/commands-simple.py')
-rw-r--r--examples/addons/commands-simple.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/addons/commands-simple.py b/examples/addons/commands-simple.py
new file mode 100644
index 00000000..c9cd6341
--- /dev/null
+++ b/examples/addons/commands-simple.py
@@ -0,0 +1,17 @@
+from mitmproxy import command
+from mitmproxy import ctx
+
+
+class MyAddon:
+ def __init__(self):
+ self.num = 0
+
+ @command.command("myaddon.inc")
+ def inc(self) -> None:
+ self.num += 1
+ ctx.log.info("num = %s" % self.num)
+
+
+addons = [
+ MyAddon()
+]