Skip to content

Python Google Pagespeed client that supports v5 api calls

Notifications You must be signed in to change notification settings

edenriquez/pagespeed-v5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pagespeed-v5

Action Status

Python wrapper over Google Page Speed v5and optional integration over Google SpreadSheet to bulk common metrics information.

  • First Contentful Paint
  • Speed Index
  • First Meaningful Paint
  • First CPU Idle
  • Max Potential First Input Delay

Installation

Use the package manager pip to install dependencies.

pip install -r requirements.txt.

pagespeed Usage

from pagespeed import PageSpeedv5 

page = PageSpeedv5(
  os.getenv("API_KEY"), # pagespeed console api key
  os.getenv("URL"),     # https://example.com
  os.getenv("STRATEGY") # desktop or mobile
)
# get light_house_result object
light_result = page.fetch_light_house()

# or get entire object
light_result = page.fetch_all()

(optional ) spreadsheet Usage

from pagespeed import SpreadsheetReporter

SHEET_PAGE = 0

# AUTH_FILE json account service private key 
# https://console.developers.google.com/apis/credentials
reporter = SpreadsheetReporter(os.getenv("AUTH_FILE"))

reporter.open(
  os.getenv("SHEET_ID"), 
  SHEET_PAGE
)

# where light_result could be for instance 
# light_result = page.fetch_light_house()

reporter.set_daily_metrics(light_result)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

About

Python Google Pagespeed client that supports v5 api calls

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages