Permalink
Browse files

Improves Google PageSpeed doc and refactor function name to compy wit…

…h PEP8.
  • Loading branch information...
tsvenson committed May 23, 2017
1 parent 84f0697 commit 1ae9edba7ffadb536d6b12023d6ab5fe5ebd9348
Showing with 15 additions and 5 deletions.
  1. +10 −1 checks/google_pagespeed.py
  2. +3 −2 default.py
  3. +2 −2 test.py
View
@@ -1,3 +1,12 @@
"""Google PageSpeed
This check uses the Google PageSpeed API to run various test to collect metrics for how
a website is performing.
Official page: https://developers.google.com/speed/pagespeed/
API key required.
"""
import json
import sys
@@ -7,7 +16,7 @@
import helper
def googlePagespeedCheck(check_url, strategy='mobile'):
def google_pagespeed_check(check_url, strategy='mobile'):
"""Checks the Pagespeed Insights with Google
In addition to the 'mobile' strategy there is also 'desktop' aimed at the desktop user's preferences
Returns a dictionary of the results.
View
@@ -9,10 +9,11 @@
from datetime import datetime
import sys
import time
import _privatekeys as privatekeys
import checks.google_pagespeed
import test
import helper
from checks.google_pagespeed import google_pagespeed_check
# local variables
# url_for_mainProcess = 'http://vgregion.se/'
@@ -87,7 +88,7 @@ def oneOffFromSitemap(url_to_sitemap, check_limit=50,
break
try:
if test_regime == 'googlePageSpeed':
check_page = checks.google_pagespeed.googlePagespeedCheck(url[1])
check_page = google_pagespeed_check(url[1])
if bool(check_page):
print('{0} has been checked against Google Pagespeed API'.format(
mess_to_console))
View
@@ -5,7 +5,7 @@
from bs4 import BeautifulSoup
import helper
from checks.google_pagespeed import googlePagespeedCheck
from checks.google_pagespeed import google_pagespeed_check
def mobileFriendlyCheck(request_url, api_key):
@@ -91,7 +91,7 @@ def thirdPartiesCheck(url):
if __name__ == '__main__':
# print(httpStatusCodeCheck('http://vgregion.se'))
# print(mobileFriendlyCheck('http://vgregion.se/', privatekeys.googleMobileFriendlyApiKey))
result = googlePagespeedCheck('http://varberg.se')
result = google_pagespeed_check('http://varberg.se')
# thirdPartiesCheck('http://sahlgrenska.se')
for key, value in result.items():

0 comments on commit 1ae9edb

Please sign in to comment.