Python 2.7 telah mencapai akhir dukungan
dan akan
dihentikan penggunaannya
pada 31 Januari 2026. Setelah penghentian penggunaan, Anda tidak akan dapat men-deploy aplikasi Python 2.7, meskipun organisasi Anda sebelumnya menggunakan kebijakan organisasi untuk mengaktifkan kembali deployment runtime lama. Aplikasi Python 2.7 yang ada akan terus berjalan dan menerima traffic setelah
tanggal penghentiannya. Sebaiknya Anda
bermigrasi ke versi Python terbaru yang didukung.
Pengendali Layanan WebApp
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Fitur ini tidak digunakan lagi. Anda harus menggunakan Library Layanan WSGI yang lebih baru untuk memublikasikan layanan sebagai aplikasi WSGI.
Modul ini berisi class yang memublikasikan layanan RPC Google Protocol menggunakan webapp framework App Engine.
Paket protorpc.webapp.service_handlers
menyediakan fungsi berikut:
- service_mapping(services, registry_path=DEFAULT_REGISTRY_PATH)
-
Membuat pemetaan layanan untuk digunakan dengan webapp.
Membuat konfigurasi dan pendaftaran default dasar untuk layanan RPC Google Protocol. Setiap layanan yang tercantum dalam pemetaan layanan memiliki factory pengendali layanan standar yang dibuat untuk layanan tersebut.
Daftar pemetaan dapat berupa jalur eksplisit ke pemetaan layanan atau hanya layanan. Layanan akan otomatis dipetakan ke nama default-nya jika pemetaan hanyalah layanan. Contoh:
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
])
Biasanya, layanan dipetakan ke jalur URL dengan menentukan tuple (jalur, layanan), dengan jalur adalah jalur tempat layanan berada, dan layanan adalah class layanan atau factory layanan untuk membuat instance layanan baru. Untuk informasi selengkapnya tentang factory layanan, lihat remote.Service.new_factory.
Jika tuple tidak disediakan, sehingga tidak ada jalur yang ditentukan, jalur default
akan dihitung menggunakan nama layanan yang sepenuhnya memenuhi syarat menggunakan pemisah jalur
URL untuk setiap komponennya, bukan tanda '.'.
Argumen
- service
- Tuple (path, service), dengan
path
adalah jalur tempat layanan berada, dan service
adalah class layanan atau factory layanan untuk membuat instance layanan baru. Untuk informasi selengkapnya tentang factory layanan, lihat remote.Service.new_factory.
- registry_path=DEFAULT_REGISTRY_PATH
- Jalur yang akan diberikan ke layanan registry. Gunakan Tidak ada untuk menonaktifkan
layanan registry.
Menampilkan daftar tuple yang menentukan pemetaan pengendali permintaan yang kompatibel dengan aplikasi WebApp.
Memunculkan ServiceConfigurationError saat jalur duplikat diberikan.
- run_services(services, registry_path=DEFAULT_REGISTRY_PATH)
-
Menangani permintaan CGI menggunakan pemetaan layanan.
Argumen
- service
- Tuple (path, service), dengan
path
adalah jalur tempat layanan berada, dan service
adalah class layanan atau factory layanan untuk membuat instance layanan baru. Untuk informasi selengkapnya tentang factory layanan, lihat remote.Service.new_factory.
- registry_path=DEFAULT_REGISTRY_PATH
- Jalur yang akan diberikan ke layanan registry. Gunakan Tidak ada untuk menonaktifkan
layanan registry.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-09-04 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 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."]]