Skip to main content

Google LightHouse Data Extractor

Project description

LightHouse Data Extract

Python Logo

This tool parses the google lighthouse json data, accepts a csv file for categories of the URLs and returns 4 pandas DataFrames for metrics, opportunities, diagnostics and resources.

Install

pip install lighthousedataextract 

Import

from lighthousedataextract import LightHouseDataExtract

Create a report variable

If json files are in directory ./repprt/lighthouse/ and you don't want to give an input file for categories of URLs

report = LightHouseDataExtract() 

If your json files are in another directory

report = LightHouseDataExtract(
    path_to_json="./data/lighthouse/report/lighthouse/"
)

If you want to seperate URLs in categories

Your CSV of URLs should have two columns, without headers. Below you can see an example:

https://www.example.com/ Home Page
https://www.example.com/categories/category-1 Middle Tail
https://www.example.com/products/product-1234 Long Tail
report = LightHouseDataExtract(url_category_file="./data/lighthouse/category.csv")

Create a lighthouse metrics DataFrame

from lighthousedataextract import LightHouseDataExtract

report = LightHouseDataExtract(
    path_to_json="./data/lighthouse/report/lighthouse/",
    url_category_file="./data/lighthouse/category.csv",
)
df_report = report.df_report()
df_report.set_index("url").T

Create other DataFrames

df_opportunities = report.df_opportunities()
display(df_opportunities)
df_diagnostics = report.df_diagnostics()
display(df_diagnostics)
df_resources = report.df_resources()
display(df_resources)

If json files are obtained by gooogle pagespeed insights api then

api_report = LightHouseDataExtract(from_api=True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lighthousedataextract-1.0.9.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lighthousedataextract-1.0.9-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file lighthousedataextract-1.0.9.tar.gz.

File metadata

  • Download URL: lighthousedataextract-1.0.9.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for lighthousedataextract-1.0.9.tar.gz
Algorithm Hash digest
SHA256 592d4021aa8c959ab9b731d18ad4ceed849d6f18ccdc364e3e0b060f5dc5cfed
MD5 d1b6fe32f8e394593abb5d2428b45ba3
BLAKE2b-256 0268c2ac5416574b0eb90f7c367fa9c4f96c60aab7e13e159620b916b70bd1f0

See more details on using hashes here.

File details

Details for the file lighthousedataextract-1.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for lighthousedataextract-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 9e2398700686391a451b74246de055eecc4210e4ff8d97370cd4734f0e668803
MD5 38e9467d658d8b6c0d515126db788882
BLAKE2b-256 8e75cd74985c3d59becc5e912edeb445e817ca1559fa90f2f0a6b5d0e8736b5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page