diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-07-13 21:40:13 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-07-13 21:45:25 -0700 |
commit | ec6fbe9eb684bbf70db796876751078865a0e50f (patch) | |
tree | bffc8f92769677453387adfbc5c33a91c5d9514c /mitmproxy/dump.py | |
parent | b8a23eeaa3c1555ae260fa21b045f002d9467bc8 (diff) | |
download | mitmproxy-ec6fbe9eb684bbf70db796876751078865a0e50f.tar.gz mitmproxy-ec6fbe9eb684bbf70db796876751078865a0e50f.tar.bz2 mitmproxy-ec6fbe9eb684bbf70db796876751078865a0e50f.zip |
make options explicit
Diffstat (limited to 'mitmproxy/dump.py')
-rw-r--r-- | mitmproxy/dump.py | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/mitmproxy/dump.py b/mitmproxy/dump.py index 296419db..90df6e1b 100644 --- a/mitmproxy/dump.py +++ b/mitmproxy/dump.py @@ -6,12 +6,14 @@ import traceback import click +from typing import Optional # noqa +import typing + from mitmproxy import contentviews from mitmproxy import controller from mitmproxy import exceptions from mitmproxy import filt from mitmproxy import flow -from mitmproxy import options from mitmproxy import builtins from netlib import human from netlib import tcp @@ -22,40 +24,20 @@ class DumpError(Exception): pass -class Options(options.Options): - attributes = [ - "app", - "app_host", - "app_port", - "anticache", - "anticomp", - "client_replay", - "filtstr", - "flow_detail", - "keepserving", - "kill", - "no_server", - "nopop", - "refresh_server_playback", - "replacements", - "rfile", - "rheaders", - "setheaders", - "server_replay", - "scripts", - "showhost", - "stickycookie", - "stickyauth", - "stream_large_bodies", - "verbosity", - "outfile", - "replay_ignore_content", - "replay_ignore_params", - "replay_ignore_payload_params", - "replay_ignore_host", - - "tfile" - ] +class Options(flow.options.Options): + def __init__( + self, + filtstr=None, # type: Optional[str] + flow_detail=1, # type: int + keepserving=False, # type: bool + tfile=None, # type: Optional[typing.io.TextIO] + **kwargs + ): + self.filtstr = filtstr + self.flow_detail = flow_detail + self.keepserving = keepserving + self.tfile = tfile + super(Options, self).__init__(**kwargs) class DumpMaster(flow.FlowMaster): @@ -63,6 +45,8 @@ class DumpMaster(flow.FlowMaster): def __init__(self, server, options): flow.FlowMaster.__init__(self, options, server, flow.State()) self.addons.add(*builtins.default_addons()) + # This line is just for type hinting + self.options = self.options # type: Options self.o = options self.showhost = options.showhost self.replay_ignore_params = options.replay_ignore_params |