mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +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
20 lines
401 B
Python
20 lines
401 B
Python
"""Handle flows as command arguments."""
|
|
import typing
|
|
|
|
from mitmproxy import command
|
|
from mitmproxy import ctx
|
|
from mitmproxy import flow
|
|
|
|
|
|
class MyAddon:
|
|
@command.command("myaddon.addheader")
|
|
def addheader(self, flows: typing.Sequence[flow.Flow]) -> None:
|
|
for f in flows:
|
|
f.request.headers["myheader"] = "value"
|
|
ctx.log.alert("done")
|
|
|
|
|
|
addons = [
|
|
MyAddon()
|
|
]
|