l.s.g.googletestservice : module documentation

Part of lp.services.googlesearch

This script runs a simple HTTP server. The server returns XML files when given certain user-configurable URLs.
Class GoogleRequestHandler Return an XML file depending on the requested URL.
Function url_to_xml_map Return our URL-to-XML mapping as a dictionary.
Function get_service_endpoint Return the host and port that the service is running on.
Function service_is_available Return True if the service is up and running.
Function wait_for_service Poll the service and BLOCK until we can connect to it.
Function wait_for_service_shutdown Poll the service until it shuts down.
Function hostpair Parse the host and port number out of a URL string.
Function start_as_process Run this file as a stand-alone Python script.
Function kill_running_process Find and kill any running web service processes.
Function safe_unlink Unlink a file, but don't raise an error if the file is missing.
Function main Run the HTTP server.
def url_to_xml_map():
Return our URL-to-XML mapping as a dictionary.
def get_service_endpoint():
Return the host and port that the service is running on.
def service_is_available(timeout=2.0):
Return True if the service is up and running.
ParameterstimeoutBLOCK execution for at most 'timeout' seconds before returning False.
def wait_for_service(timeout=15.0):
Poll the service and BLOCK until we can connect to it.
ParameterstimeoutThe socket should timeout after this many seconds. Refer to the socket module documentation in the Standard Library for possible timeout values.
def wait_for_service_shutdown(seconds_to_wait=10.0):
Poll the service until it shuts down.

Raises a RuntimeError if the service doesn't shut down within the allotted time, under normal operation. It may also raise various socket errors if there are issues connecting to the service (host lookup, etc.)

Parametersseconds_to_waitThe number of seconds to wait for the socket to open up.
def hostpair(url):
Parse the host and port number out of a URL string.
def start_as_process():
Run this file as a stand-alone Python script.

Returns a subprocess.Popen object. (See the subprocess module in the Python Standard Library for details.)

def kill_running_process():
Find and kill any running web service processes.
def safe_unlink(filepath):
Unlink a file, but don't raise an error if the file is missing.
def main():
Run the HTTP server.
API Documentation for Launchpad, generated by pydoctor at 2018-02-26 00:00:03.