mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
08895e9ba6
- restructure examples (fix #4031) - remove example dependencies from setup.py, we do not need special dependencies for our supported addons. - unify how we generate docs from code - improve example docs
19 lines
333 B
Python
19 lines
333 B
Python
"""Add a custom command to mitmproxy's command prompt."""
|
|
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(f"num = {self.num}")
|
|
|
|
|
|
addons = [
|
|
MyAddon()
|
|
]
|