1<html><body> 2<style> 3 4body, h1, h2, h3, div, span, p, pre, a { 5 margin: 0; 6 padding: 0; 7 border: 0; 8 font-weight: inherit; 9 font-style: inherit; 10 font-size: 100%; 11 font-family: inherit; 12 vertical-align: baseline; 13} 14 15body { 16 font-size: 13px; 17 padding: 1em; 18} 19 20h1 { 21 font-size: 26px; 22 margin-bottom: 1em; 23} 24 25h2 { 26 font-size: 24px; 27 margin-bottom: 1em; 28} 29 30h3 { 31 font-size: 20px; 32 margin-bottom: 1em; 33 margin-top: 1em; 34} 35 36pre, code { 37 line-height: 1.5; 38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; 39} 40 41pre { 42 margin-top: 0.5em; 43} 44 45h1, h2, h3, p { 46 font-family: Arial, sans serif; 47} 48 49h1, h2, h3 { 50 border-bottom: solid #CCC 1px; 51} 52 53.toc_element { 54 margin-top: 0.5em; 55} 56 57.firstline { 58 margin-left: 2 em; 59} 60 61.method { 62 margin-top: 1em; 63 border: solid 1px #CCC; 64 padding: 1em; 65 background: #EEE; 66} 67 68.details { 69 font-weight: bold; 70 font-size: 14px; 71} 72 73</style> 74 75<h1><a href="pagespeedonline_v1.html">PageSpeed Insights API</a> . <a href="pagespeedonline_v1.pagespeedapi.html">pagespeedapi</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#runpagespeed">runpagespeed(url, screenshot=None, locale=None, rule=None, strategy=None, filter_third_party_resources=None)</a></code></p> 79<p class="firstline">Runs PageSpeed analysis on the page at the specified URL, and returns a PageSpeed score, a list of suggestions to make that page faster, and other information.</p> 80<h3>Method Details</h3> 81<div class="method"> 82 <code class="details" id="runpagespeed">runpagespeed(url, screenshot=None, locale=None, rule=None, strategy=None, filter_third_party_resources=None)</code> 83 <pre>Runs PageSpeed analysis on the page at the specified URL, and returns a PageSpeed score, a list of suggestions to make that page faster, and other information. 84 85Args: 86 url: string, The URL to fetch and analyze (required) 87 screenshot: boolean, Indicates if binary data containing a screenshot should be included 88 locale: string, The locale used to localize formatted results 89 rule: string, A PageSpeed rule to run; if none are given, all rules are run (repeated) 90 strategy: string, The analysis strategy to use 91 Allowed values 92 desktop - Fetch and analyze the URL for desktop browsers 93 mobile - Fetch and analyze the URL for mobile devices 94 filter_third_party_resources: boolean, Indicates if third party resources should be filtered out before PageSpeed analysis. 95 96Returns: 97 An object of the form: 98 99 { 100 "kind": "pagespeedonline#result", # Kind of result. 101 "captchaResult": "A String", # The captcha verify result 102 "responseCode": 42, # Response code for the document. 200 indicates a normal page load. 4xx/5xx indicates an error. 103 "screenshot": { # Base64-encoded screenshot of the page that was analyzed. 104 "width": 42, # Width of screenshot in pixels. 105 "data": "A String", # Image data base64 encoded. 106 "mime_type": "A String", # Mime type of image data. E.g. "image/jpeg". 107 "height": 42, # Height of screenshot in pixels. 108 }, 109 "title": "A String", # Title of the page, as displayed in the browser's title bar. 110 "version": { # The version of PageSpeed used to generate these results. 111 "major": 42, # The major version number of PageSpeed used to generate these results. 112 "minor": 42, # The minor version number of PageSpeed used to generate these results. 113 }, 114 "score": 42, # The PageSpeed Score (0-100), which indicates how much faster a page could be. A high score indicates little room for improvement, while a lower score indicates more room for improvement. 115 "formattedResults": { # Localized PageSpeed results. Contains a ruleResults entry for each PageSpeed rule instantiated and run by the server. 116 "locale": "A String", # The locale of the formattedResults, e.g. "en_US". 117 "ruleResults": { # Dictionary of formatted rule results, with one entry for each PageSpeed rule instantiated and run by the server. 118 "a_key": { # The enum-like identifier for this rule. For instance "EnableKeepAlive" or "AvoidCssImport". Not localized. 119 "localizedRuleName": "A String", # Localized name of the rule, intended for presentation to a user. 120 "urlBlocks": [ # List of blocks of URLs. Each block may contain a heading and a list of URLs. Each URL may optionally include additional details. 121 { 122 "header": { # Heading to be displayed with the list of URLs. 123 "args": [ # List of arguments for the format string. 124 { 125 "type": "A String", # Type of argument. One of URL, STRING_LITERAL, INT_LITERAL, BYTES, or DURATION. 126 "value": "A String", # Argument value, as a localized string. 127 }, 128 ], 129 "format": "A String", # A localized format string with $N placeholders, where N is the 1-indexed argument number, e.g. 'Minifying the following $1 resources would save a total of $2 bytes'. 130 }, 131 "urls": [ # List of entries that provide information about URLs in the url block. Optional. 132 { 133 "details": [ # List of entries that provide additional details about a single URL. Optional. 134 { 135 "args": [ # List of arguments for the format string. 136 { 137 "type": "A String", # Type of argument. One of URL, STRING_LITERAL, INT_LITERAL, BYTES, or DURATION. 138 "value": "A String", # Argument value, as a localized string. 139 }, 140 ], 141 "format": "A String", # A localized format string with $N placeholders, where N is the 1-indexed argument number, e.g. 'Unnecessary metadata for this resource adds an additional $1 bytes to its download size'. 142 }, 143 ], 144 "result": { # A format string that gives information about the URL, and a list of arguments for that format string. 145 "args": [ # List of arguments for the format string. 146 { 147 "type": "A String", # Type of argument. One of URL, STRING_LITERAL, INT_LITERAL, BYTES, or DURATION. 148 "value": "A String", # Argument value, as a localized string. 149 }, 150 ], 151 "format": "A String", # A localized format string with $N placeholders, where N is the 1-indexed argument number, e.g. 'Minifying the resource at URL $1 can save $2 bytes'. 152 }, 153 }, 154 ], 155 }, 156 ], 157 "ruleImpact": 3.14, # The impact (unbounded floating point value) that implementing the suggestions for this rule would have on making the page faster. Impact is comparable between rules to determine which rule's suggestions would have a higher or lower impact on making a page faster. For instance, if enabling compression would save 1MB, while optimizing images would save 500kB, the enable compression rule would have 2x the impact of the image optimization rule, all other things being equal. 158 }, 159 }, 160 }, 161 "invalidRules": [ # List of rules that were specified in the request, but which the server did not know how to instantiate. 162 "A String", 163 ], 164 "pageStats": { # Summary statistics for the page, such as number of JavaScript bytes, number of HTML bytes, etc. 165 "otherResponseBytes": "A String", # Number of response bytes for other resources on the page. 166 "flashResponseBytes": "A String", # Number of response bytes for flash resources on the page. 167 "totalRequestBytes": "A String", # Total size of all request bytes sent by the page. 168 "numberCssResources": 42, # Number of CSS resources referenced by the page. 169 "numberResources": 42, # Number of HTTP resources loaded by the page. 170 "cssResponseBytes": "A String", # Number of uncompressed response bytes for CSS resources on the page. 171 "javascriptResponseBytes": "A String", # Number of uncompressed response bytes for JS resources on the page. 172 "imageResponseBytes": "A String", # Number of response bytes for image resources on the page. 173 "numberHosts": 42, # Number of unique hosts referenced by the page. 174 "numberStaticResources": 42, # Number of static (i.e. cacheable) resources on the page. 175 "htmlResponseBytes": "A String", # Number of uncompressed response bytes for the main HTML document and all iframes on the page. 176 "numberJsResources": 42, # Number of JavaScript resources referenced by the page. 177 "textResponseBytes": "A String", # Number of uncompressed response bytes for text resources not covered by other statistics (i.e non-HTML, non-script, non-CSS resources) on the page. 178 }, 179 "id": "A String", # Canonicalized and final URL for the document, after following page redirects (if any). 180 }</pre> 181</div> 182 183</body></html>