From be9329dfd4e2be420ab3ab945565d8d377adf374 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Sat, 20 Feb 2016 20:49:55 +0530 Subject: [PATCH 1/2] har_extractor: Use items() instead of iteritems() --- examples/har_extractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/har_extractor.py b/examples/har_extractor.py index 4e905438e..050d36876 100644 --- a/examples/har_extractor.py +++ b/examples/har_extractor.py @@ -131,7 +131,7 @@ def response(context, flow): request_http_version = flow.request.http_version # Cookies are shaped as tuples by MITMProxy. request_cookies = [{"name": k.strip(), "value": v[0]} - for k, v in (flow.request.get_cookies() or {}).iteritems()] + for k, v in (flow.request.get_cookies() or {}).items()] request_headers = [{"name": k, "value": v} for k, v in flow.request.headers] request_headers_size = len(str(flow.request.headers)) request_body_size = len(flow.request.content) @@ -139,7 +139,7 @@ def response(context, flow): response_http_version = flow.response.http_version # Cookies are shaped as tuples by MITMProxy. response_cookies = [{"name": k.strip(), "value": v[0]} - for k, v in (flow.response.get_cookies() or {}).iteritems()] + for k, v in (flow.response.get_cookies() or {}).items()] response_headers = [{"name": k, "value": v} for k, v in flow.response.headers] response_headers_size = len(str(flow.response.headers)) From 6bb27c162f845d01e9d3eaab4f776a3a5f4b30bb Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Sat, 20 Feb 2016 21:01:42 +0530 Subject: [PATCH 2/2] har_extractor: Replace deprecated stuff with recommended ones --- examples/har_extractor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/har_extractor.py b/examples/har_extractor.py index 050d36876..e7718fe80 100644 --- a/examples/har_extractor.py +++ b/examples/har_extractor.py @@ -127,11 +127,11 @@ def response(context, flow): tz=utc).isoformat() request_query_string = [{"name": k, "value": v} - for k, v in flow.request.get_query()] + for k, v in flow.request.query] request_http_version = flow.request.http_version # Cookies are shaped as tuples by MITMProxy. request_cookies = [{"name": k.strip(), "value": v[0]} - for k, v in (flow.request.get_cookies() or {}).items()] + for k, v in flow.request.cookies.items()] request_headers = [{"name": k, "value": v} for k, v in flow.request.headers] request_headers_size = len(str(flow.request.headers)) request_body_size = len(flow.request.content) @@ -139,7 +139,7 @@ def response(context, flow): response_http_version = flow.response.http_version # Cookies are shaped as tuples by MITMProxy. response_cookies = [{"name": k.strip(), "value": v[0]} - for k, v in (flow.response.get_cookies() or {}).items()] + for k, v in flow.response.cookies.items()] response_headers = [{"name": k, "value": v} for k, v in flow.response.headers] response_headers_size = len(str(flow.response.headers))