aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/complex/har_dump.py4
-rw-r--r--examples/simple/wsgi_flask_app.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/examples/complex/har_dump.py b/examples/complex/har_dump.py
index e3cea9fd..8f46ee0d 100644
--- a/examples/complex/har_dump.py
+++ b/examples/complex/har_dump.py
@@ -99,8 +99,8 @@ def response(flow):
started_date_time = datetime.fromtimestamp(flow.request.timestamp_start, timezone.utc).isoformat()
# Response body size and encoding
- response_body_size = len(flow.response.raw_content)
- response_body_decoded_size = len(flow.response.content)
+ response_body_size = len(flow.response.raw_content) if flow.response.raw_content else 0
+ response_body_decoded_size = len(flow.response.content) if flow.response.content else 0
response_body_compression = response_body_decoded_size - response_body_size
entry = {
diff --git a/examples/simple/wsgi_flask_app.py b/examples/simple/wsgi_flask_app.py
index 4be38000..bbde6913 100644
--- a/examples/simple/wsgi_flask_app.py
+++ b/examples/simple/wsgi_flask_app.py
@@ -14,12 +14,12 @@ def hello_world() -> str:
return 'Hello World!'
-def load(l):
+addons = [
# Host app at the magic domain "proxapp.local" on port 80. Requests to this
# domain and port combination will now be routed to the WSGI app instance.
- return wsgiapp.WSGIApp(app, "proxapp.local", 80)
-
+ wsgiapp.WSGIApp(app, "proxapp.local", 80)
# SSL works too, but the magic domain needs to be resolvable from the mitmproxy machine due to mitmproxy's design.
# mitmproxy will connect to said domain and use serve its certificate (unless --no-upstream-cert is set)
# but won't send any data.
# mitmproxy.ctx.master.apps.add(app, "example.com", 443)
+]