diff options
Diffstat (limited to 'examples/simple')
-rw-r--r-- | examples/simple/README.md | 2 | ||||
-rw-r--r-- | examples/simple/filter_flows.py | 6 | ||||
-rw-r--r-- | examples/simple/io_write_dumpfile.py | 2 | ||||
-rw-r--r-- | examples/simple/log_events.py | 5 |
4 files changed, 6 insertions, 9 deletions
diff --git a/examples/simple/README.md b/examples/simple/README.md index d140a84c..2fafdd5a 100644 --- a/examples/simple/README.md +++ b/examples/simple/README.md @@ -14,5 +14,5 @@ | modify_querystring.py | Modify HTTP query strings. | | redirect_requests.py | Redirect a request to a different server. | | send_reply_from_proxy.py | Send a HTTP response directly from the proxy. | -| upsidedownternet.py | Turn all images upside down. | +| internet_in_mirror.py | Turn all images upside down. | | wsgi_flask_app.py | Embed a WSGI app into mitmproxy. | diff --git a/examples/simple/filter_flows.py b/examples/simple/filter_flows.py index 70979591..aba240de 100644 --- a/examples/simple/filter_flows.py +++ b/examples/simple/filter_flows.py @@ -7,7 +7,7 @@ from mitmproxy import ctx, http class Filter: def __init__(self): - self.filter = None # type: flowfilter.TFilter + self.filter: flowfilter.TFilter = None def configure(self, updated): self.filter = flowfilter.parse(ctx.options.flowfilter) @@ -19,8 +19,8 @@ class Filter: def response(self, flow: http.HTTPFlow) -> None: if flowfilter.match(self.filter, flow): - print("Flow matches filter:") - print(flow) + ctx.log.info("Flow matches filter:") + ctx.log.info(flow) addons = [Filter()] diff --git a/examples/simple/io_write_dumpfile.py b/examples/simple/io_write_dumpfile.py index be6e4121..c8c59c62 100644 --- a/examples/simple/io_write_dumpfile.py +++ b/examples/simple/io_write_dumpfile.py @@ -13,7 +13,7 @@ import typing # noqa class Writer: def __init__(self, path: str) -> None: - self.f = open(path, "wb") # type: typing.IO[bytes] + self.f: typing.IO[bytes] = open(path, "wb") self.w = io.FlowWriter(self.f) def response(self, flow: http.HTTPFlow) -> None: diff --git a/examples/simple/log_events.py b/examples/simple/log_events.py index b9aa2c1f..4f70e340 100644 --- a/examples/simple/log_events.py +++ b/examples/simple/log_events.py @@ -1,10 +1,7 @@ -""" -It is recommended to use `ctx.log` for logging within a script. -print() statements are equivalent to ctx.log.warn(). -""" from mitmproxy import ctx def load(l): ctx.log.info("This is some informative text.") + ctx.log.warn("This is a warning.") ctx.log.error("This is an error.") |