Merge pull request #1257 from tdickers/master

Make har_extractor.py output HAR 1.2 spec-compliant
This commit is contained in:
Maximilian Hils 2016-06-14 10:03:13 -07:00 committed by GitHub
commit 26fe7dc87d
2 changed files with 7 additions and 4 deletions

View File

@ -4,6 +4,7 @@
""" """
import six import six
import sys import sys
import pytz
from harparser import HAR from harparser import HAR
from datetime import datetime from datetime import datetime
@ -120,7 +121,7 @@ def response(context, flow):
full_time = sum(v for v in timings.values() if v > -1) full_time = sum(v for v in timings.values() if v > -1)
started_date_time = datetime.utcfromtimestamp( 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} request_query_string = [{"name": k, "value": v}
for k, v in flow.request.query or {}] for k, v in flow.request.query or {}]
@ -174,6 +175,7 @@ def response(context, flow):
"startedDateTime": entry['startedDateTime'], "startedDateTime": entry['startedDateTime'],
"id": page_id, "id": page_id,
"title": flow.request.url, "title": flow.request.url,
"pageTimings": {}
}) })
) )
context.HARLog.set_page_ref(flow.request.url, page_id) context.HARLog.set_page_ref(flow.request.url, page_id)

View File

@ -10,15 +10,16 @@
}, },
"pages": [ "pages": [
{ {
"startedDateTime": "1993-08-24T14:41:12", "startedDateTime": "1993-08-24T14:41:12+00:00",
"id": "autopage_1", "id": "autopage_1",
"title": "http://address:22/path" "title": "http://address:22/path",
"pageTimings": {}
} }
], ],
"entries": [ "entries": [
{ {
"pageref": "autopage_1", "pageref": "autopage_1",
"startedDateTime": "1993-08-24T14:41:12", "startedDateTime": "1993-08-24T14:41:12+00:00",
"cache": {}, "cache": {},
"request": { "request": {
"cookies": [], "cookies": [],