aboutsummaryrefslogtreecommitdiffstats
path: root/examples/har_extractor.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-06-14 10:03:13 -0700
committerGitHub <noreply@github.com>2016-06-14 10:03:13 -0700
commit26fe7dc87d83acca8541a618f105e6d5532cf55f (patch)
tree55e9a880081f6b129917d6d9d45be21b4bf1225e /examples/har_extractor.py
parenta63817f2b8539cab0b645e0eda772daeaf898ed3 (diff)
parentc2d0910e593faf34bae37f5c9b5cfaae509bdf8c (diff)
downloadmitmproxy-26fe7dc87d83acca8541a618f105e6d5532cf55f.tar.gz
mitmproxy-26fe7dc87d83acca8541a618f105e6d5532cf55f.tar.bz2
mitmproxy-26fe7dc87d83acca8541a618f105e6d5532cf55f.zip
Merge pull request #1257 from tdickers/master
Make har_extractor.py output HAR 1.2 spec-compliant
Diffstat (limited to 'examples/har_extractor.py')
-rw-r--r--examples/har_extractor.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/har_extractor.py b/examples/har_extractor.py
index c21f1a8f..d6b50c21 100644
--- a/examples/har_extractor.py
+++ b/examples/har_extractor.py
@@ -4,6 +4,7 @@
"""
import six
import sys
+import pytz
from harparser import HAR
from datetime import datetime
@@ -120,7 +121,7 @@ def response(context, flow):
full_time = sum(v for v in timings.values() if v > -1)
started_date_time = datetime.utcfromtimestamp(
- flow.request.timestamp_start).isoformat()
+ flow.request.timestamp_start).replace(tzinfo=pytz.timezone("UTC")).isoformat()
request_query_string = [{"name": k, "value": v}
for k, v in flow.request.query or {}]
@@ -174,6 +175,7 @@ def response(context, flow):
"startedDateTime": entry['startedDateTime'],
"id": page_id,
"title": flow.request.url,
+ "pageTimings": {}
})
)
context.HARLog.set_page_ref(flow.request.url, page_id)