aboutsummaryrefslogtreecommitdiffstats
path: root/examples/addons/commands-simple.py
blob: c9cd63414ced3a4a656f289e7be7a14b5c575617 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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()
]