aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/addons/core.py
blob: 3f9cb15e1e5cf1512769fe6978f457e8d2c68d17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from mitmproxy import ctx
from mitmproxy import exceptions
from mitmproxy import command


class Core:
    @command.command("set")
    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. Boolean values can be true,
            false or toggle.
        """
        try:
            ctx.options.set(spec)
        except exceptions.OptionsError as e:
            raise exceptions.CommandError(e) from e