diff options
author | ColdFire <9128903+fenilgandhi@users.noreply.github.com> | 2018-02-23 00:27:10 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-23 00:27:10 +0530 |
commit | 777cb98a86f3e8883383935661e2ed20ed9b6bd4 (patch) | |
tree | 67d3e1259dccb83866496f45fe20ac3bd76961ce /examples/addons/commands-flows.py | |
parent | 6bf250aa3e8ede84d16170d95728c6488444a5a8 (diff) | |
parent | 58ccad7576e5fd33e937aba58df2f9edc389e52e (diff) | |
download | mitmproxy-777cb98a86f3e8883383935661e2ed20ed9b6bd4.tar.gz mitmproxy-777cb98a86f3e8883383935661e2ed20ed9b6bd4.tar.bz2 mitmproxy-777cb98a86f3e8883383935661e2ed20ed9b6bd4.zip |
Merge branch 'master' into issue-2872
Diffstat (limited to 'examples/addons/commands-flows.py')
-rw-r--r-- | examples/addons/commands-flows.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/addons/commands-flows.py b/examples/addons/commands-flows.py new file mode 100644 index 00000000..cebc8f9d --- /dev/null +++ b/examples/addons/commands-flows.py @@ -0,0 +1,21 @@ +import typing + +from mitmproxy import command +from mitmproxy import ctx +from mitmproxy import flow + + +class MyAddon: + def __init__(self): + self.num = 0 + + @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() +] |