mitmproxy/examples/addons/commands-simple.py

18 lines
317 B
Python
Raw Normal View History

"""Add a custom command to mitmproxy's command prompt."""
import logging
from mitmproxy import command
class MyAddon:
def __init__(self):
self.num = 0
@command.command("myaddon.inc")
def inc(self) -> None:
self.num += 1
logging.info(f"num = {self.num}")
2022-04-26 11:53:35 +00:00
addons = [MyAddon()]