diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-03-14 13:02:58 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-14 13:02:58 +1300 |
commit | 124a6c9e5af44121208c3362215cc3ea895ffad7 (patch) | |
tree | 8c8f24f119aae9b22832bfa0e6b5c0a397133d17 /examples/simple/custom_option.py | |
parent | ee65894d40f5a9f73125a8d3e73ba50540939e5b (diff) | |
parent | 1b301ad5bbe5765b608bf4f8480720065d3343c8 (diff) | |
download | mitmproxy-124a6c9e5af44121208c3362215cc3ea895ffad7.tar.gz mitmproxy-124a6c9e5af44121208c3362215cc3ea895ffad7.tar.bz2 mitmproxy-124a6c9e5af44121208c3362215cc3ea895ffad7.zip |
Merge pull request #2129 from cortesi/addonopts
Custom options for addons
Diffstat (limited to 'examples/simple/custom_option.py')
-rw-r--r-- | examples/simple/custom_option.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/simple/custom_option.py b/examples/simple/custom_option.py new file mode 100644 index 00000000..324d27e7 --- /dev/null +++ b/examples/simple/custom_option.py @@ -0,0 +1,11 @@ +from mitmproxy import ctx + + +def start(options): + ctx.log.info("Registering option 'custom'") + options.add_option("custom", bool, False, "A custom option") + + +def configure(options, updated): + if "custom" in updated: + ctx.log.info("custom option value: %s" % options.custom) |