Python 2.7 has reached end of support
and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Python 2.7
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Python
2.7 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of Python.
WebApp Service Handlers
Stay organized with collections
Save and categorize content based on your preferences.
This feature is deprecated. You should use the newer WSGI 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.
The protorpc.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:
from protorpc import remote
from protorpc.webapp import service_handlers
package = 'my_package'
class MyService(remote.Service):
...
service_handlers.service_mapping(
[('/my_path', MyService), # Maps to /my_path
MyService, # 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 see remote.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), 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 see remote.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 a WebApp 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), 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 see remote.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 the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eThis feature is deprecated, and users should transition to the WSGI Service Library for publishing services as WSGI applications.\u003c/p\u003e\n"],["\u003cp\u003eThe module contains classes for publishing Google Protocol RPC services using the App Engine Webapp framework.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eservice_mapping\u003c/code\u003e creates a services mapping for webapp, defining paths and service classes or factories for each service, allowing for both explicit and default path mappings.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003erun_services\u003c/code\u003e handles CGI requests using the service mapping defined, taking services and registry path as arguments.\u003c/p\u003e\n"],["\u003cp\u003eServices can be mapped to a user specified URL path or to a default path based on their fully qualified name, using the \u003ccode\u003eservice_mapping\u003c/code\u003e function.\u003c/p\u003e\n"]]],[],null,["# WebApp Service Handlers\n\nThis feature is deprecated. You should use the newer [WSGI Service Library](/appengine/docs/legacy/standard/python/tools/protorpc/wsgi) to publish the service as a WSGI application.\n\nThis module contains classes that publish a Google Protocol RPC service using the App Engine Webapp framework.\n\nThe `protorpc.webapp.service_handlers` package provides the following functions:\n\nservice_mapping(services, registry_path=DEFAULT_REGISTRY_PATH)\n\n: Creates a services mapping for use with webapp.\n\n 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.\n\n 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: \n\n ```python\n from protorpc import remote\n from protorpc.webapp import service_handlers\n\n package = 'my_package'\n\n class MyService(remote.Service):\n ...\n\n service_handlers.service_mapping(\n [('/my_path', MyService), # Maps to /my_path\n MyService, # Maps to /my_package/MyService\n ])\n ```\n\n Normally, services are mapped to URL paths by specifying a tuple\n (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 see [remote.Service.new_factory](/appengine/docs/legacy/standard/python/tools/protorpc/remote/serviceclass#new_factory).\n\n If no tuple is provided, and therefore no path specified, a default path\n is calculated by using the fully qualified service name using a URL path\n separator for each of its components instead of a '.'.\n **Arguments**\n\n services\n : 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 see [remote.Service.new_factory](/appengine/docs/legacy/standard/python/tools/protorpc/remote/serviceclass#new_factory).\n\n registry_path=DEFAULT_REGISTRY_PATH\n : Path to provide to the registry service. Use None to disable\n registry service.\n\n Returns a list of tuples defining a mapping of request handlers compatible with a [WebApp](/appengine/docs/legacy/standard/python/tools/webapp) application.\n\n Raises a ServiceConfigurationError when duplicate paths are provided.\n\nrun_services(services, registry_path=DEFAULT_REGISTRY_PATH)\n\n: Handles CGI request using service mapping.\n\n **Arguments**\n\n services\n : 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 see [remote.Service.new_factory](/appengine/docs/legacy/standard/python/tools/protorpc/remote/serviceclass#new_factory).\n\n registry_path=DEFAULT_REGISTRY_PATH\n : Path to provide to the registry service. Use None to disable\n registry service."]]