Package tlib :: Package asset :: Package wpt_batch_lib :: Module wpt_batch_lib
[hide private]
[frames] | no frames]

Module wpt_batch_lib

source code

A library to support batch processing of WebPageTest tests.

This module provides a set of APIs for batch processing of WebPageTest tests. A complete test cycle typically consists of test submission, checking test status, test result download, etc.

A sample usage of this library can be found in wpt_batch.py.


Author: zhaoq@google.com (Qi Zhao)

Functions [hide private]
 
__LoadEntity(url, urlopen=<function urlopen at 0x0000000002EC1A58>)
A helper function to load an entity such as an URL.
source code
 
ImportUrls(url_filename)
Load the URLS in the file into memory.
source code
 
SubmitBatch(url_list, test_params, server_url='http://www.webpagetest.org/', urlopen=<function urlopen at 0x0000000002EC1A58>)
Submit the tests to WebPageTest server.
source code
 
CheckBatchStatus(test_ids, server_url='http://www.webpagetest.org/', urlopen=<function urlopen at 0x0000000002EC1A58>)
Check the status of tests.
source code
 
GetXMLResult(test_ids, server_url='http://www.webpagetest.org/', urlopen=<function urlopen at 0x0000000002EC1A58>)
Obtain the test result in XML format.
source code
Variables [hide private]
  __package__ = 'tlib.asset.wpt_batch_lib'
Function Details [hide private]

__LoadEntity(url, urlopen=<function urlopen at 0x0000000002EC1A58>)

source code 
A helper function to load an entity such as an URL.

Args:
  url: the URL to load
  urlopen: the callable to be used to load the url

Returns:
  The response message

ImportUrls(url_filename)

source code 
Load the URLS in the file into memory.

Args:
  url_filename: the file name of the list of URLs

Returns:
  The list of URLS

SubmitBatch(url_list, test_params, server_url='http://www.webpagetest.org/', urlopen=<function urlopen at 0x0000000002EC1A58>)

source code 
Submit the tests to WebPageTest server.

Args:
  url_list: the list of interested URLs
  test_params: the user-configured test parameters
  server_url: the URL of the WebPageTest server
  urlopen: the callable to be used to load the request

Returns:
  A dictionary which maps a WPT test id to its URL if submission
  is successful.

CheckBatchStatus(test_ids, server_url='http://www.webpagetest.org/', urlopen=<function urlopen at 0x0000000002EC1A58>)

source code 
Check the status of tests.

Args:
  test_ids: the list of interested test ids
  server_url: the URL of the WebPageTest server
  urlopen: the callable to be used to load the request

Returns:
  A dictionary where key is the test id and content is its status.

GetXMLResult(test_ids, server_url='http://www.webpagetest.org/', urlopen=<function urlopen at 0x0000000002EC1A58>)

source code 
Obtain the test result in XML format.

Args:
  test_ids: the list of interested test ids
  server_url: the URL of WebPageTest server
  urlopen: the callable to be used to load the request

Returns:
  A dictionary where the key is test id and the value is a DOM object of the
  test result.