mitmproxy/examples/simple/custom_option.py
Aldo Cortesi 0c6663d0d5 Enable custom options for addons
- Add an options parameter to the start() event. This is to be used by addons
on startup to add custom options.
- Add a running() event that is called once the proxy is up and running.
- With the new paradigm we can't log during master __init__, so add a tiny
termstatus addon to print proxy status to terminal once we're running.
2017-03-14 08:32:19 +13:00

11 lines
260 B
Python

from mitmproxy import ctx
def start(options):
ctx.log.info("Registering option 'custom'")
options.add_option("custom", str, "default", "A custom option")
def configure(options, updated):
ctx.log.info("custom option value: %s" % options.custom)