aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/addons/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'mitmproxy/addons/core.py')
-rw-r--r--mitmproxy/addons/core.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/mitmproxy/addons/core.py b/mitmproxy/addons/core.py
new file mode 100644
index 00000000..7b648403
--- /dev/null
+++ b/mitmproxy/addons/core.py
@@ -0,0 +1,18 @@
+from mitmproxy import ctx
+from mitmproxy import exceptions
+
+
+class Core:
+ def set(self, spec: str) -> None:
+ """
+ Set an option of the form "key[=value]". When the value is omitted,
+ booleans are set to true, strings and integers are set to None (if
+ permitted), and sequences are emptied.
+ """
+ try:
+ ctx.options.set(spec)
+ except exceptions.OptionsError as e:
+ raise exceptions.CommandError(e) from e
+
+ def load(self, l):
+ l.add_command("set", self.set)