批处理库

一、API介绍

我们目前为用户提供以下Python API,帮助他们实现自己的特别批处理测试,添加更多的API。 如果你要添加新的API,可以通过详细说明向wpt-eng@google.com发送请求。我们将评估你的请求,并回复您。

二、API描述

2.1 创建批处理测试

  1. def ImportUrls(url_filename):
  2. """Load the URLS in the file into memory.
  3. Args:
  4. url_filename: the file name of the list of interested URLs
  5. Returns:
  6. The list of URLS
  7. """

2.2 提交批处理测试

  1. def SubmitBatch(url_list, test_params, server_url):
  2. """Submit the tests to WebPageTest server.
  3. Args:
  4. url_list: the list of interested URLs
  5. test_params: the user-configured test parameters
  6. server_url: the URL of the WebPageTest server
  7. Returns:
  8. A dictionary which maps a WPT test id to its URL if submission
  9. is successful.
  10. """

2.3 检查批处理测试的测试状态

  1. def CheckBatchStatus(test_ids, server_url):
  2. """Check the status of tests.
  3. Args:
  4. test_ids: the list of interested test ids
  5. server_url: the URL of the WebPageTest server
  6. Returns:
  7. A dictionary where key is the test id and content is its status.
  8. """

2.4 获取批处理测试的测试结果

  1. def GetXMLResult(test_ids, server_url):
  2. """Obtain the test result in XML format.
  3. Args:
  4. test_ids: the list of interested test ids
  5. server_url: the URL of WebPageTest server
  6. Returns:
  7. A dictionary where the key is test id and the value is a DOM object of the
  8. test result.
  9. """