Close httplib2 connections.
Runs PageSpeed analysis on the page at the specified URL, and returns PageSpeed scores, a list of suggestions to make that page faster, and other information.
close()
Close httplib2 connections.
runpagespeed(url, captchaToken=None, category=None, locale=None, strategy=None, utm_campaign=None, utm_source=None, x__xgafv=None)
Runs PageSpeed analysis on the page at the specified URL, and returns PageSpeed scores, a list of suggestions to make that page faster, and other information. Args: url: string, Required. The URL to fetch and analyze (required) captchaToken: string, The captcha token passed when filling out a captcha. category: string, A Lighthouse category to run; if none are given, only Performance category will be run (repeated) Allowed values CATEGORY_UNSPECIFIED - Default UNDEFINED category. ACCESSIBILITY - Accessibility (a11y), category pertaining to a website's capacity to be accessible to all users. BEST_PRACTICES - Best Practices, category pertaining to a website's conformance to web best practice. PERFORMANCE - Performance, category pertaining to a website's performance. PWA - Progressive Web App (PWA), category pertaining to a website's ability to be run as a PWA. This is deprecated in Lighthouse's 12.0 release. SEO - Search Engine Optimization (SEO), category pertaining to a website's ability to be indexed by search engines. locale: string, The locale used to localize formatted results strategy: string, The analysis strategy (desktop or mobile) to use, and desktop is the default Allowed values STRATEGY_UNSPECIFIED - UNDEFINED. DESKTOP - Fetch and analyze the URL for desktop browsers. MOBILE - Fetch and analyze the URL for mobile devices. utm_campaign: string, Campaign name for analytics. utm_source: string, Campaign source for analytics. x__xgafv: string, V1 error format. Allowed values 1 - v1 error format 2 - v2 error format Returns: An object of the form: { # The Pagespeed API response object. "analysisUTCTimestamp": "A String", # The UTC timestamp of this analysis. "captchaResult": "A String", # The captcha verify result "id": "A String", # Canonicalized and final URL for the document, after following page redirects (if any). "kind": "A String", # Kind of result. "lighthouseResult": { # The Lighthouse result object. # Lighthouse response for the audit url as an object. "audits": { # Map of audits in the LHR. "a_key": { # An audit's result object in a Lighthouse result. "description": "A String", # The description of the audit. "details": { # Freeform details section of the audit. "a_key": "", # Properties of the object. }, "displayValue": "A String", # The value that should be displayed on the UI for this audit. "errorMessage": "A String", # An error message from a thrown error inside the audit. "explanation": "A String", # An explanation of the errors in the audit. "id": "A String", # The audit's id. "metricSavings": { # The metric savings of the audit. # The metric savings of the audit. "CLS": 3.14, # Optional. Optional numeric value representing the audit's savings for the CLS metric. "FCP": 3.14, # Optional. Optional numeric value representing the audit's savings for the FCP metric. "INP": 3.14, # Optional. Optional numeric value representing the audit's savings for the INP metric. "LCP": 3.14, # Optional. Optional numeric value representing the audit's savings for the LCP metric. "TBT": 3.14, # Optional. Optional numeric value representing the audit's savings for the TBT metric. }, "numericUnit": "A String", # The unit of the numeric_value field. Used to format the numeric value for display. "numericValue": 3.14, # A numeric value that has a meaning specific to the audit, e.g. the number of nodes in the DOM or the timestamp of a specific load event. More information can be found in the audit details, if present. "score": "", # The score of the audit, can be null. "scoreDisplayMode": "A String", # The enumerated score display mode. "title": "A String", # The human readable title. "warnings": "", # Possible warnings that occurred in the audit, can be null. }, }, "categories": { # The categories in a Lighthouse run. # Map of categories in the LHR. "accessibility": { # A Lighthouse category. # The accessibility category, containing all accessibility related audits. "auditRefs": [ # An array of references to all the audit members of this category. { # A light reference to an audit by id, used to group and weight audits in a given category. "acronym": "A String", # The conventional acronym for the audit/metric. "group": "A String", # The category group that the audit belongs to (optional). "id": "A String", # The audit ref id. "relevantAudits": [ # Any audit IDs closely relevant to this one. "A String", ], "weight": 3.14, # The weight this audit's score has on the overall category score. }, ], "description": "A String", # A more detailed description of the category and its importance. "id": "A String", # The string identifier of the category. "manualDescription": "A String", # A description for the manual audits in the category. "score": "", # The overall score of the category, the weighted average of all its audits. (The category's score, can be null.) "title": "A String", # The human-friendly name of the category. }, "best-practices": { # A Lighthouse category. # The best practices category, containing all best practices related audits. "auditRefs": [ # An array of references to all the audit members of this category. { # A light reference to an audit by id, used to group and weight audits in a given category. "acronym": "A String", # The conventional acronym for the audit/metric. "group": "A String", # The category group that the audit belongs to (optional). "id": "A String", # The audit ref id. "relevantAudits": [ # Any audit IDs closely relevant to this one. "A String", ], "weight": 3.14, # The weight this audit's score has on the overall category score. }, ], "description": "A String", # A more detailed description of the category and its importance. "id": "A String", # The string identifier of the category. "manualDescription": "A String", # A description for the manual audits in the category. "score": "", # The overall score of the category, the weighted average of all its audits. (The category's score, can be null.) "title": "A String", # The human-friendly name of the category. }, "performance": { # A Lighthouse category. # The performance category, containing all performance related audits. "auditRefs": [ # An array of references to all the audit members of this category. { # A light reference to an audit by id, used to group and weight audits in a given category. "acronym": "A String", # The conventional acronym for the audit/metric. "group": "A String", # The category group that the audit belongs to (optional). "id": "A String", # The audit ref id. "relevantAudits": [ # Any audit IDs closely relevant to this one. "A String", ], "weight": 3.14, # The weight this audit's score has on the overall category score. }, ], "description": "A String", # A more detailed description of the category and its importance. "id": "A String", # The string identifier of the category. "manualDescription": "A String", # A description for the manual audits in the category. "score": "", # The overall score of the category, the weighted average of all its audits. (The category's score, can be null.) "title": "A String", # The human-friendly name of the category. }, "pwa": { # A Lighthouse category. # The Progressive-Web-App (PWA) category, containing all pwa related audits. This is deprecated in Lighthouse's 12.0 release. "auditRefs": [ # An array of references to all the audit members of this category. { # A light reference to an audit by id, used to group and weight audits in a given category. "acronym": "A String", # The conventional acronym for the audit/metric. "group": "A String", # The category group that the audit belongs to (optional). "id": "A String", # The audit ref id. "relevantAudits": [ # Any audit IDs closely relevant to this one. "A String", ], "weight": 3.14, # The weight this audit's score has on the overall category score. }, ], "description": "A String", # A more detailed description of the category and its importance. "id": "A String", # The string identifier of the category. "manualDescription": "A String", # A description for the manual audits in the category. "score": "", # The overall score of the category, the weighted average of all its audits. (The category's score, can be null.) "title": "A String", # The human-friendly name of the category. }, "seo": { # A Lighthouse category. # The Search-Engine-Optimization (SEO) category, containing all seo related audits. "auditRefs": [ # An array of references to all the audit members of this category. { # A light reference to an audit by id, used to group and weight audits in a given category. "acronym": "A String", # The conventional acronym for the audit/metric. "group": "A String", # The category group that the audit belongs to (optional). "id": "A String", # The audit ref id. "relevantAudits": [ # Any audit IDs closely relevant to this one. "A String", ], "weight": 3.14, # The weight this audit's score has on the overall category score. }, ], "description": "A String", # A more detailed description of the category and its importance. "id": "A String", # The string identifier of the category. "manualDescription": "A String", # A description for the manual audits in the category. "score": "", # The overall score of the category, the weighted average of all its audits. (The category's score, can be null.) "title": "A String", # The human-friendly name of the category. }, }, "categoryGroups": { # Map of category groups in the LHR. "a_key": { # Message containing a category "description": "A String", # The description of what the category is grouping "title": "A String", # The human readable title of the group }, }, "configSettings": { # Message containing the configuration settings for the Lighthouse run. # The configuration settings for this LHR. "channel": "A String", # How Lighthouse was run, e.g. from the Chrome extension or from the npm module. "emulatedFormFactor": "A String", # The form factor the emulation should use. This field is deprecated, form_factor should be used instead. "formFactor": "A String", # How Lighthouse should interpret this run in regards to scoring performance metrics and skipping mobile-only tests in desktop. "locale": "A String", # The locale setting. "onlyCategories": "", # List of categories of audits the run should conduct. }, "entities": [ # Entity classification data. { # Message containing an Entity. "category": "A String", # Optional. An optional category name for the entity. "homepage": "A String", # Optional. An optional homepage URL of the entity. "isFirstParty": True or False, # Optional. An optional flag indicating if the entity is the first party. "isUnrecognized": True or False, # Optional. An optional flag indicating if the entity is not recognized. "name": "A String", # Required. Name of the entity. "origins": [ # Required. A list of URL origin strings that belong to this entity. "A String", ], }, ], "environment": { # Message containing environment configuration for a Lighthouse run. # Environment settings that were used when making this LHR. "benchmarkIndex": 3.14, # The benchmark index number that indicates rough device class. "credits": { # The version of libraries with which these results were generated. Ex: axe-core. "a_key": "A String", }, "hostUserAgent": "A String", # The user agent string of the version of Chrome used. "networkUserAgent": "A String", # The user agent string that was sent over the network. }, "fetchTime": "A String", # The time that this run was fetched. "finalDisplayedUrl": "A String", # URL displayed on the page after Lighthouse finishes. "finalUrl": "A String", # The final resolved url that was audited. "fullPageScreenshot": "", # Screenshot data of the full page, along with node rects relevant to the audit results. "i18n": { # Message containing the i18n data for the LHR - Version 1. # The internationalization strings that are required to render the LHR. "rendererFormattedStrings": { # Message holding the formatted strings used in the renderer. # Internationalized strings that are formatted to the locale in configSettings. "auditGroupExpandTooltip": "A String", # The tooltip text on an expandable chevron icon. "calculatorLink": "A String", # Text link pointing to the Lighthouse scoring calculator. This link immediately follows a sentence stating the performance score is calculated from the perf metrics. "crcInitialNavigation": "A String", # The label for the initial request in a critical request chain. "crcLongestDurationLabel": "A String", # The label for values shown in the summary of critical request chains. "dropdownCopyJSON": "A String", # Option in a dropdown menu that copies the Lighthouse JSON object to the system clipboard. "dropdownDarkTheme": "A String", # Option in a dropdown menu that toggles the themeing of the report between Light(default) and Dark themes. "dropdownPrintExpanded": "A String", # Option in a dropdown menu that opens a full Lighthouse report in a print dialog. "dropdownPrintSummary": "A String", # Option in a dropdown menu that opens a small, summary report in a print dialog. "dropdownSaveGist": "A String", # Option in a dropdown menu that saves the current report as a new GitHub Gist. "dropdownSaveHTML": "A String", # Option in a dropdown menu that saves the Lighthouse report HTML locally to the system as a '.html' file. "dropdownSaveJSON": "A String", # Option in a dropdown menu that saves the Lighthouse JSON object to the local system as a '.json' file. "dropdownViewer": "A String", # Option in a dropdown menu that opens the current report in the Lighthouse Viewer Application. "errorLabel": "A String", # The label shown next to an audit or metric that has had an error. "errorMissingAuditInfo": "A String", # The error string shown next to an erroring audit. "footerIssue": "A String", # Label for button to create an issue against the Lighthouse GitHub project. "labDataTitle": "A String", # The title of the lab data performance category. "lsPerformanceCategoryDescription": "A String", # The disclaimer shown under performance explaining that the network can vary. "manualAuditsGroupTitle": "A String", # The heading shown above a list of audits that were not computerd in the run. "notApplicableAuditsGroupTitle": "A String", # The heading shown above a list of audits that do not apply to a page. "opportunityResourceColumnLabel": "A String", # The heading for the estimated page load savings opportunity of an audit. "opportunitySavingsColumnLabel": "A String", # The heading for the estimated page load savings of opportunity audits. "passedAuditsGroupTitle": "A String", # The heading that is shown above a list of audits that are passing. "runtimeDesktopEmulation": "A String", # Descriptive explanation for emulation setting when emulating a generic desktop form factor, as opposed to a mobile-device like form factor. "runtimeMobileEmulation": "A String", # Descriptive explanation for emulation setting when emulating a Nexus 5X mobile device. "runtimeNoEmulation": "A String", # Descriptive explanation for emulation setting when no device emulation is set. "runtimeSettingsAxeVersion": "A String", # Label for a row in a table that shows the version of the Axe library used "runtimeSettingsBenchmark": "A String", # Label for a row in a table that shows the estimated CPU power of the machine running Lighthouse. Example row values: 532, 1492, 783. "runtimeSettingsCPUThrottling": "A String", # Label for a row in a table that describes the CPU throttling conditions that were used during a Lighthouse run, if any. "runtimeSettingsChannel": "A String", # Label for a row in a table that shows in what tool Lighthouse is being run (e.g. The lighthouse CLI, Chrome DevTools, Lightrider, WebPageTest, etc). "runtimeSettingsDevice": "A String", # Label for a row in a table that describes the kind of device that was emulated for the Lighthouse run. Example values for row elements: 'No Emulation', 'Emulated Desktop', etc. "runtimeSettingsFetchTime": "A String", # Label for a row in a table that shows the time at which a Lighthouse run was conducted; formatted as a timestamp, e.g. Jan 1, 1970 12:00 AM UTC. "runtimeSettingsNetworkThrottling": "A String", # Label for a row in a table that describes the network throttling conditions that were used during a Lighthouse run, if any. "runtimeSettingsTitle": "A String", # Title of the Runtime settings table in a Lighthouse report. Runtime settings are the environment configurations that a specific report used at auditing time. "runtimeSettingsUA": "A String", # Label for a row in a table that shows the User Agent that was detected on the Host machine that ran Lighthouse. "runtimeSettingsUANetwork": "A String", # Label for a row in a table that shows the User Agent that was used to send out all network requests during the Lighthouse run. "runtimeSettingsUrl": "A String", # Label for a row in a table that shows the URL that was audited during a Lighthouse run. "runtimeUnknown": "A String", # Descriptive explanation for a runtime setting that is set to an unknown value. "scorescaleLabel": "A String", # The label that explains the score gauges scale (0-49, 50-89, 90-100). "showRelevantAudits": "A String", # Label preceding a radio control for filtering the list of audits. The radio choices are various performance metrics (FCP, LCP, TBT), and if chosen, the audits in the report are hidden if they are not relevant to the selected metric. "snippetCollapseButtonLabel": "A String", # The label for the button to show only a few lines of a snippet "snippetExpandButtonLabel": "A String", # The label for the button to show all lines of a snippet "thirdPartyResourcesLabel": "A String", # This label is for a filter checkbox above a table of items "throttlingProvided": "A String", # Descriptive explanation for environment throttling that was provided by the runtime environment instead of provided by Lighthouse throttling. "toplevelWarningsMessage": "A String", # The label shown preceding important warnings that may have invalidated an entire report. "varianceDisclaimer": "A String", # The disclaimer shown below a performance metric value. "viewTreemapLabel": "A String", # Label for a button that opens the Treemap App "warningAuditsGroupTitle": "A String", # The heading that is shown above a list of audits that have warnings "warningHeader": "A String", # The label shown above a bulleted list of warnings. }, }, "lighthouseVersion": "A String", # The lighthouse version that was used to generate this LHR. "mainDocumentUrl": "A String", # URL of the main document request of the final navigation. "requestedUrl": "A String", # The original requested url. "runWarnings": [ # List of all run warnings in the LHR. Will always output to at least `[]`. "", ], "runtimeError": { # Message containing a runtime error config. # A top-level error message that, if present, indicates a serious enough problem that this Lighthouse result may need to be discarded. "code": "A String", # The enumerated Lighthouse Error code. "message": "A String", # A human readable message explaining the error code. }, "stackPacks": [ # The Stack Pack advice strings. { # Message containing Stack Pack information. "descriptions": { # The stack pack advice strings. "a_key": "A String", }, "iconDataURL": "A String", # The stack pack icon data uri. "id": "A String", # The stack pack id. "title": "A String", # The stack pack title. }, ], "timing": { # Message containing the performance timing data for the Lighthouse run. # Timing information for this LHR. "total": 3.14, # The total duration of Lighthouse's run. }, "userAgent": "A String", # The user agent that was used to run this LHR. }, "loadingExperience": { # The CrUX loading experience object that contains CrUX data breakdowns. # Metrics of end users' page loading experience. "id": "A String", # The url, pattern or origin which the metrics are on. "initial_url": "A String", # The requested URL, which may differ from the resolved "id". "metrics": { # The map of . "a_key": { # A CrUX metric object for a single metric and form factor. "category": "A String", # The category of the specific time metric. "distributions": [ # Metric distributions. Proportions should sum up to 1. { # A proportion of data in the total distribution, bucketed by a min/max percentage. Each bucket's range is bounded by min <= x < max, In millisecond. "max": 42, # Upper bound for a bucket's range. "min": 42, # Lower bound for a bucket's range. "proportion": 3.14, # The proportion of data in this bucket. }, ], "formFactor": "A String", # Identifies the form factor of the metric being collected. "median": 42, # The median number of the metric, in millisecond. "metricId": "A String", # Identifies the type of the metric. "percentile": 42, # We use this field to store certain percentile value for this metric. For v4, this field contains pc50. For v5, this field contains pc90. }, }, "origin_fallback": True or False, # True if the result is an origin fallback from a page, false otherwise. "overall_category": "A String", # The human readable speed "category" of the id. }, "originLoadingExperience": { # The CrUX loading experience object that contains CrUX data breakdowns. # Metrics of the aggregated page loading experience of the origin "id": "A String", # The url, pattern or origin which the metrics are on. "initial_url": "A String", # The requested URL, which may differ from the resolved "id". "metrics": { # The map of . "a_key": { # A CrUX metric object for a single metric and form factor. "category": "A String", # The category of the specific time metric. "distributions": [ # Metric distributions. Proportions should sum up to 1. { # A proportion of data in the total distribution, bucketed by a min/max percentage. Each bucket's range is bounded by min <= x < max, In millisecond. "max": 42, # Upper bound for a bucket's range. "min": 42, # Lower bound for a bucket's range. "proportion": 3.14, # The proportion of data in this bucket. }, ], "formFactor": "A String", # Identifies the form factor of the metric being collected. "median": 42, # The median number of the metric, in millisecond. "metricId": "A String", # Identifies the type of the metric. "percentile": 42, # We use this field to store certain percentile value for this metric. For v4, this field contains pc50. For v5, this field contains pc90. }, }, "origin_fallback": True or False, # True if the result is an origin fallback from a page, false otherwise. "overall_category": "A String", # The human readable speed "category" of the id. }, "version": { # The Pagespeed Version object. # The version of PageSpeed used to generate these results. "major": "A String", # The major version number of PageSpeed used to generate these results. "minor": "A String", # The minor version number of PageSpeed used to generate these results. }, }