Created
November 8, 2018 09:48
-
-
Save davehunt/e53a6c0d1a820782dd1344d84c007cf9 to your computer and use it in GitHub Desktop.
Show location and user agents from WebPageTest results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
with open("/Users/dhunt/Desktop/wpt.json") as f: | |
data = json.load(f) | |
for test in data: | |
location = test["data"]["location"] | |
request_headers = test["data"]["runs"]["1"]["firstView"]["requests"][0]["headers"]["request"] | |
user_agent = next(filter(lambda x: x.startswith("User-Agent:"), request_headers)) | |
print(f"location: {location}") | |
print(f"- user-agent: {user_agent}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment