![]() |
App Engine Python SDK
v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
|
Public Member Functions | |
def | __init__ |
def | get_module_names |
def | get_versions |
def | get_default_version |
def | get_hostname |
def | set_num_instances |
def | get_num_instances |
def | start_version |
def | stop_version |
def | add_event |
def | update_event |
def | add_request |
def | add_async_request |
def | send_background_request |
![]() | |
def | get_module_names |
def | get_versions |
def | get_default_version |
def | get_hostname |
def | set_num_instances |
def | get_num_instances |
def | start_version |
def | stop_version |
def | add_event |
def | update_event |
def | add_request |
def | add_async_request |
def | send_background_request |
A fake Dispatcher implementation usable by tests.
def google.appengine.api.request_info._LocalFakeDispatcher.add_async_request | ( | self, | |
method, | |||
relative_url, | |||
headers, | |||
body, | |||
source_ip, | |||
module_name = None , |
|||
version = None , |
|||
instance_id = None |
|||
) |
Dispatch an HTTP request asynchronously. Args: method: A str containing the HTTP method of the request. relative_url: A str containing path and query string of the request. headers: A list of (key, value) tuples where key and value are both str. body: A str containing the request body. source_ip: The source ip address for the request. module_name: An optional str containing the module name to service this request. If unset, the request will be dispatched to the default module. version: An optional str containing the version to service this request. If unset, the request will be dispatched to the default version. instance_id: An optional str containing the instance_id of the instance to service this request. If unset, the request will be dispatched to according to the load-balancing for the module and version.
def google.appengine.api.request_info._LocalFakeDispatcher.add_event | ( | self, | |
runnable, | |||
eta, | |||
service = None , |
|||
event_id = None |
|||
) |
Add a callable to be run at the specified time. Args: runnable: A callable object to call at the specified time. eta: An int containing the time to run the event, in seconds since the epoch. service: A str containing the name of the service that owns this event. This should be set if event_id is set. event_id: A str containing the id of the event. If set, this can be passed to update_event to change the time at which the event should run.
def google.appengine.api.request_info._LocalFakeDispatcher.add_request | ( | self, | |
method, | |||
relative_url, | |||
headers, | |||
body, | |||
source_ip, | |||
module_name = None , |
|||
version = None , |
|||
instance_id = None |
|||
) |
Process an HTTP request. Args: method: A str containing the HTTP method of the request. relative_url: A str containing path and query string of the request. headers: A list of (key, value) tuples where key and value are both str. body: A str containing the request body. source_ip: The source ip address for the request. module_name: An optional str containing the module name to service this request. If unset, the request will be dispatched to the default module. version: An optional str containing the version to service this request. If unset, the request will be dispatched to the default version. instance_id: An optional str containing the instance_id of the instance to service this request. If unset, the request will be dispatched to according to the load-balancing for the module and version. Returns: A ResponseTuple containing the response information for the HTTP request.
def google.appengine.api.request_info._LocalFakeDispatcher.get_default_version | ( | self, | |
module | |||
) |
Returns the default version for a module. Args: module: A str containing the name of the module. Returns: A str containing the default version for the specified module. Raises: ModuleDoesNotExistError: The module does not exist.
def google.appengine.api.request_info._LocalFakeDispatcher.get_hostname | ( | self, | |
module, | |||
version, | |||
instance = None |
|||
) |
Returns the hostname for a (module, version, instance) tuple. If instance is set, this will return a hostname for that particular instances. Otherwise, it will return the hostname for load-balancing. Args: module: A str containing the name of the module. version: A str containing the version. instance: An optional str containing the instance ID. Returns: A str containing the hostname. Raises: ModuleDoesNotExistError: The module does not exist. VersionDoesNotExistError: The version does not exist. InvalidInstanceIdError: The instance ID is not valid for the module/version or the module/version uses automatic scaling.
def google.appengine.api.request_info._LocalFakeDispatcher.get_module_names | ( | self | ) |
Returns a list of module names.
def google.appengine.api.request_info._LocalFakeDispatcher.get_num_instances | ( | self, | |
module, | |||
version | |||
) |
Gets the number of instances running for a version of a module. Args: module: A str containing the name of the module. version: A str containing the version. Raises: ModuleDoesNotExistError: The module does not exist. VersionDoesNotExistError: The version does not exist. NotSupportedWithAutoScalingError: The provided module/version uses automatic scaling.
def google.appengine.api.request_info._LocalFakeDispatcher.get_versions | ( | self, | |
module | |||
) |
Returns a list of versions for a module. Args: module: A str containing the name of the module. Returns: A list of str containing the versions for the specified module. Raises: ModuleDoesNotExistError: The module does not exist.
def google.appengine.api.request_info._LocalFakeDispatcher.send_background_request | ( | self, | |
module_name, | |||
version, | |||
instance, | |||
background_request_id | |||
) |
Dispatch a background thread request. Args: module_name: A str containing the module name to service this request. version: A str containing the version to service this request. instance: The instance to service this request. background_request_id: A str containing the unique background thread request identifier. Raises: NotSupportedWithAutoScalingError: The provided module/version uses automatic scaling. BackgroundThreadLimitReachedError: The instance is at its background thread capacity.
def google.appengine.api.request_info._LocalFakeDispatcher.set_num_instances | ( | self, | |
module, | |||
version, | |||
instances | |||
) |
Sets the number of instances to run for a version of a module. Args: module: A str containing the name of the module. version: A str containing the version. instances: An int containing the number of instances to run. Raises: ModuleDoesNotExistError: The module does not exist. VersionDoesNotExistError: The version does not exist. NotSupportedWithAutoScalingError: The provided module/version uses automatic scaling.
def google.appengine.api.request_info._LocalFakeDispatcher.start_version | ( | self, | |
module, | |||
version | |||
) |
Starts a version. Args: module: A str containing the name of the module. version: A str containing the version. Raises: ModuleDoesNotExistError: The module does not exist. VersionDoesNotExistError: The version does not exist. NotSupportedWithAutoScalingError: The provided module/version uses automatic scaling.
def google.appengine.api.request_info._LocalFakeDispatcher.stop_version | ( | self, | |
module, | |||
version | |||
) |
Stops a version. Args: module: A str containing the name of the module. version: A str containing the version. Raises: ModuleDoesNotExistError: The module does not exist. VersionDoesNotExistError: The version does not exist. NotSupportedWithAutoScalingError: The provided module/version uses automatic scaling.
def google.appengine.api.request_info._LocalFakeDispatcher.update_event | ( | self, | |
eta, | |||
service, | |||
event_id | |||
) |
Update the eta of a scheduled event. Args: eta: An int containing the time to run the event, in seconds since the epoch. service: A str containing the name of the service that owns this event. event_id: A str containing the id of the event to update.