Python 2.7 はサポートが終了しており、2026 年 1 月 31 日に
非推奨になります。非推奨になると、過去に組織のポリシーを使用して以前のランタイムのデプロイを再度有効にしていた場合でも、Python 2.7 アプリケーションをデプロイできなくなります。既存の Python 2.7 アプリケーションは、
非推奨日以降も引き続き実行され、トラフィックを受信します。
サポートされている最新バージョンの Python に移行することをおすすめします。
WSGI サービス ライブラリ
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
このモジュールには、Google Protocol RPC サービスを WSGI アプリケーションとして公開するクラスが含まれています。
protorpc.wsgi.service
パッケージは、次の関数を提供します。
- service_mapping(service_factory, service_path=r'.*', protocols=None)
-
1 つの Google Protocol RPC サービス マッピングを処理する WSGI アプリケーションを作成します。
引数
- service_factory
- サービスの新しいインスタンスを作成するためのサービスクラスまたはサービス ファクトリ。サービス ファクトリの詳細については、remote.Service.new_factory をご覧ください。
- service_path=r'.*'
- サービスが配置されている場所のパス。
- protocols=None
- サポートされるプロトコルを構成する remote.Protocols インスタンス。
1 つの Google Protocol RPC サービス マッピングを処理する WSGI アプリケーションを返します。
- service_mappings(services, registry_path=DEFAULT_REGISTRY_PATH)
-
オプションのレジストリ サービスとともに、複数のサービス マッピングを使用して WSGI アプリケーションを作成します。例:
from protorpc import remote
from protorpc.wsgi import service
package = 'my_package'
class MyService(remote.Service):
...
class MyOtherService(remote.Service):
...
app = service.service_mappings(
[('/my_path', MyService), # Maps to /my_path
('/my_other_path', MyOtherService), # Maps to /my_other_path
])
サービスは、タプル(path, service)を指定することで URL パスにマッピングされます。ここで path は、サービスが配置されている場所のパスであり、service は、サービスの新しいインスタンスを作成するためのサービスクラスまたはサービス ファクトリです。サービス ファクトリの詳細については、remote.Service.new_factory をご覧ください。引数
- services
- タプル(path, service)のリスト。
path
は、サービスが配置されている場所のパスです。service
は、サービスの新しいインスタンスを作成するためのサービスクラスまたはサービス ファクトリです。サービス ファクトリの詳細については、remote.Service.new_factory をご覧ください。
- registry_path=DEFAULT_REGISTRY_PATH
- レジストリ サービスに対して指定するパス。レジストリ サービスを無効にする場合は、None を使用します。
オプションのレジストリ サービスとともに、複数のサービス マッピングを使用して WSGI アプリケーションを返します。
重複したパスが指定された場合は、ServiceConfigurationError
が発生します。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-04 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eThis module provides tools to publish Google Protocol RPC services as WSGI applications.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eservice_mapping\u003c/code\u003e function creates a WSGI application for a single RPC service, using a service factory or class to instantiate the service.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eservice_mappings\u003c/code\u003e function enables the creation of a WSGI application that hosts multiple services, each mapped to a specific URL path.\u003c/p\u003e\n"],["\u003cp\u003eBoth functions allow the use of service factories for the creation of service instances.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eservice_mappings\u003c/code\u003e function can include an optional registry service and will raise a \u003ccode\u003eServiceConfigurationError\u003c/code\u003e if duplicate paths are given.\u003c/p\u003e\n"]]],[],null,["# WSGI Service Library\n\nThis module contains classes that publish a Google Protocol RPC service as a WSGI application.\n\nThe `protorpc.wsgi.service` package provides the following functions:\n\nservice_mapping(service_factory, service_path=r'.\\*', protocols=None)\n\n: Creates a WSGI application that handles a single Google Protocol RPC service mapping.\n\n **Arguments**\n\n service_factory\n : 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 service_path=r'.\\*'\n : The path where the service resides.\n\n protocols=None\n : A remote.Protocols instance that configures supported protocols on the server.\n\n Returns a WSGI application that handles a single Google Protocol RPC service mapping.\n\nservice_mappings(services, registry_path=DEFAULT_REGISTRY_PATH)\n\n: Creates a WSGI application with multiple service mappings with an optional registry service. For example:\n\n ```python\n from protorpc import remote\n from protorpc.wsgi import service\n\n package = 'my_package'\n\n class MyService(remote.Service):\n ...\n\n class MyOtherService(remote.Service):\n ...\n\n app = service.service_mappings(\n [('/my_path', MyService), # Maps to /my_path\n ('/my_other_path', MyOtherService), # Maps to /my_other_path\n ])\n ```\n\n 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 **Arguments**\n\n services\n : A list of tuples (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 registry service.\n\n Returns a WSGI application with multiple service mappings with an optional registry service.\n\n Raises a `ServiceConfigurationError` when duplicate paths are provided."]]