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.

WSGI Service Library

This module contains classes that publish a Google Protocol RPC service as a WSGI application.

Theprotorpc.wsgi.service package provides the following functions:

service_mapping(service_factory,service_path=r'.*',protocols=None)

Creates a WSGI application that handles a single Google Protocol RPC service mapping.

Arguments
service_factory
The service class or service factory for creating new instances of the service. For more information about service factories, please seeremote.Service.new_factory.
service_path=r'.*'
The path where the service resides.
protocols=None
A remote.Protocols instance that configures supported protocols on the server.

Returns a WSGI application that handles a single Google Protocol RPC service mapping.

service_mappings(services,registry_path=DEFAULT_REGISTRY_PATH)

Creates a WSGI application with multiple service mappings with an optional registry service. For example:

fromprotorpcimportremotefromprotorpc.wsgiimportservicepackage='my_package'classMyService(remote.Service):...classMyOtherService(remote.Service):...app=service.service_mappings([('/my_path',MyService),# Maps to /my_path('/my_other_path',MyOtherService),# Maps to /my_other_path])

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.Arguments

services
A list of tuples (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 WSGI application with multiple service mappings with an optional registry service.

Raises aServiceConfigurationError when duplicate paths are provided.

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.