WSGI-Dienstbibliothek
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Dieses Modul enthält Klassen, die einen Google Protocol RPC-Dienst als WSGI-Anwendung veröffentlichen.
Das protorpc.wsgi.service
-Paket bietet folgende Funktionen:
- service_mapping(service_factory, service_path=r'.*', protocols=None)
-
Erstellt eine WSGI-Anwendung, die eine einzelne Google Protocol RPC-Dienstzuordnung verarbeitet.
Argumente
- service_factory
- Die Dienstklasse oder Dienst-Factory zum Erstellen neuer Instanzen des Service. Weitere Informationen zu Dienst-Factories finden Sie unter remote.Service.new_factory.
- service_path=r'.
- Der Pfad, in dem sich der Dienst befindet.
- protocols=None
- Eine remote.Protocols-Instanz, die unterstützte Protokolle auf dem Server konfiguriert.
Gibt eine WSGI-Anwendung zurück, die eine einzelne Google Protocol RPC-Dienstzuordnung verarbeitet.
- service_mappings(services, registry_path=DEFAULT_REGISTRY_PATH)
-
Erstellt eine WSGI-Anwendung mit mehreren Dienstzuordnungen und einem optionalen Registrierungsdienst. Beispiel:
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
])
Dienste werden URL-Pfaden in der Regel durch Angeben eines Tupels (Pfad, Dienst) zugeordnet, wobei es sich beim Pfad um den Pfad handelt, unter dem sich der Dienst befindet, und beim Dienst um die Dienstklasse oder Dienst-Factory zum Erstellen neuer Instanzen des Dienstes. Weitere Informationen zu Dienst-Factories finden Sie unter remote.Service.new_factory.
Argumente
- services
- Eine Liste von Tupeln (Pfad, Dienst), wobei es sich bei
path
um den Pfad handelt, unter dem sich der Dienst befindet, und bei service
um die Dienstklasse oder Dienst-Factory zum Erstellen neuer Instanzen des Dienstes. Weitere Informationen zu Dienst-Factories finden Sie unter remote.Service.new_factory.
- registry_path=DEFAULT_REGISTRY_PATH
- Pfad, der für den Registrierungsdienst bereitzustellen ist. Verwenden Sie "None", um den Registrierungsdienst zu deaktivieren.
Gibt eine WSGI-Anwendung mit mehreren Dienstzuordnungen und einem optionalen Registrierungsdienst zurück.
Gibt einen ServiceConfigurationError
aus, wenn doppelte Pfade angegeben werden.
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-09-04 (UTC).
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 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."]]