Python 2.7 has reached end of supportand will bedeprecatedon January 31, 2026. After deprecation, you won't be able to deploy Python 2.7applications, even if your organization previously used an organization policy tore-enable deployments of legacy runtimes. Your existing Python2.7 applications will continue to run and receive traffic after theirdeprecation date. We recommend thatyoumigrate to the latest supported version of Python.

WebApp Service Handlers

This feature is deprecated. You should use the newerWSGI Service Library to publish the service as a WSGI application.

This module contains classes that publish a Google Protocol RPC service using the App Engine Webapp framework.

Theprotorpc.webapp.service_handlers package provides the following functions:

service_mapping(services,registry_path=DEFAULT_REGISTRY_PATH)

Creates a services mapping for use with webapp.

Creates basic default configuration and registration for Google Protocol RPC services. Each service listed in the service mapping has a standard service handler factory created for it.

The list of mappings can either be an explicit path to service mapping or just services. If mappings are just services, they will automatically be mapped to their default name. For example:

fromprotorpcimportremotefromprotorpc.webappimportservice_handlerspackage='my_package'classMyService(remote.Service):...service_handlers.service_mapping([('/my_path',MyService),# Maps to /my_pathMyService,# Maps to /my_package/MyService])

Normally, services are mapped to URL paths by specifying a tuple (path, service), where path is the path where the service resides, and service is the service class or service factory for creating new instances of the service. For more information about service factories, please seeremote.Service.new_factory.

If no tuple is provided, and therefore no path specified, a default path is calculated by using the fully qualified service name using a URL path separator for each of its components instead of a '.'.

Arguments
services
A tuple (path, service), wherepath is the path where the service resides, andservice is the service class or service factory for creating new instances of the service. For more information about service factories, please seeremote.Service.new_factory.
registry_path=DEFAULT_REGISTRY_PATH
Path to provide to the registry service. Use None to disable registry service.

Returns a list of tuples defining a mapping of request handlers compatible with aWebApp application.

Raises a ServiceConfigurationError when duplicate paths are provided.

run_services(services,registry_path=DEFAULT_REGISTRY_PATH)

Handles CGI request using service mapping.

Arguments
services
A tuple (path, service), wherepath is the path where the service resides, andservice is the service class or service factory for creating new instances of the service. For more information about service factories, please seeremote.Service.new_factory.
registry_path=DEFAULT_REGISTRY_PATH
Path to provide to the registry service. Use None to disable registry service.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.