Created
May 27, 2016 13:42
-
-
Save ncouture/b39024a6c0939cc016240dca56d83c3b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/python | |
PAGESPEED_API_KEY='<...>' | |
import json | |
import requests | |
import pprint | |
from googleapiclient.discovery import build | |
URL='https://duckduckgo.com/?q=pizzeria+in+little+italy&ia=places' | |
discoverer = build('pagespeedonline', 'v2', developerKey=PAGESPEED_API_KEY) | |
api = discoverer.pagespeedapi() | |
resp = json.loads(api.runpagespeed(url=URL, screenshot=True, locale='en_US', ).to_json()) | |
data = requests.get(resp['uri']) | |
results = json.loads(data.text) | |
pprint.pprint(results) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment