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.
Stay organized with collections
Save and categorize content based on your preferences.
google.appengine.ext.remote_api.handler module
Summary
A handler that exports various App Engine services over HTTP.
You can export this handler in your app by adding it to the builtins section:
builtins:
- remote_api: on
This will add remote_api serving to the path /_ah/remote_api.
You can also add it to your handlers section, e.g.:
handlers:
- url: /remote_api(/.*)?
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
You can use remote_api_stub to remotely access services exported by this
handler. See the documentation in remote_api_stub.py for details on how to do
this.
The handler supports several forms of authentication. By default, it
checks that the user is an admin using the Users API, similar to specifying
“login: admin” in the app.yaml file. It also supports a ‘custom header’ mode
which can be used in certain scenarios.
To configure the custom header mode, edit an appengine_config file (the same
one you may use to configure appstats) to include a line like this:
- remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = (
-
‘HTTP_X_APPENGINE_INBOUND_APPID’, [‘otherappid’] )
See the ConfigDefaults class below for the full set of options available.
Contents
- class google.appengine.ext.remote_api.handler.ApiCallHandlersource
-
Bases: google.appengine.ext.webapp._webapp25.RequestHandler
A webapp handler that accepts API calls over HTTP and executes them.
- ExecuteRequest(request)source
-
Executes an API invocation and returns the response object.
- InfoPage()source
-
Renders an information page.
- LOCAL_STUBS = {'remote_datastore': <google.appengine.ext.remote_api.handler.RemoteDatastoreStub object>}
- OAUTH_SCOPES = ['https://www.googleapis.com/auth/appengine.apis', 'https://www.googleapis.com/auth/cloud-platform']
- get()source
-
Handle a GET. Just show an info page.
- post()source
-
Handle POST requests by executing the API call.
- class google.appengine.ext.remote_api.handler.ConfigDefaultssource
-
Bases: object
Configurable constants.
To override remote_api configuration values, define values like this
in your appengine_config.py file (in the root of your app):
- remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = (
-
‘HTTP_X_APPENGINE_INBOUND_APPID’, [‘otherappid’] )
You may wish to base this file on sample_appengine_config.py.
- CUSTOM_ENVIRONMENT_AUTHENTICATION = ()
- class google.appengine.ext.remote_api.handler.RemoteDatastoreStub(service='datastore_v3', _test_stub_map=None)source
-
Bases: google.appengine.api.apiproxy_stub.APIProxyStub
Provides a stub that permits execution of stateful datastore queries.
Some operations aren’t possible using the standard interface. Notably,
datastore RunQuery operations internally store a cursor that is referenced in
later Next calls, and cleaned up at the end of each request. Because every
call to ApiCallHandler takes place in its own request, this isn’t possible.
To work around this, RemoteDatastoreStub provides its own implementation of
RunQuery that immediately returns the query results.
- google.appengine.ext.remote_api.handler.main()source
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-06-16 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-06-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003egoogle.appengine.ext.remote_api.handler\u003c/code\u003e module allows you to export App Engine services over HTTP, enabling remote access to these services.\u003c/p\u003e\n"],["\u003cp\u003eYou can enable the remote API handler in your \u003ccode\u003eapp.yaml\u003c/code\u003e file, either in the \u003ccode\u003ebuiltins\u003c/code\u003e section for serving at \u003ccode\u003e/_ah/remote_api\u003c/code\u003e or in the \u003ccode\u003ehandlers\u003c/code\u003e section to define a custom URL path.\u003c/p\u003e\n"],["\u003cp\u003eThe module provides several authentication methods, with admin user verification as the default, but it also offers a 'custom header' mode for more flexible authentication configurations via the \u003ccode\u003eappengine_config\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eApiCallHandler\u003c/code\u003e class handles API calls over HTTP and includes methods for request handling, and serving an information page.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRemoteDatastoreStub\u003c/code\u003e class provides an implementation of the datastore \u003ccode\u003eRunQuery\u003c/code\u003e that can immediately return query results.\u003c/p\u003e\n"]]],[],null,["# google.appengine.ext.remote_api.handler module\n==============================================\n\nSummary\n-------\n\nA handler that exports various App Engine services over HTTP.\n\nYou can export this handler in your app by adding it to the builtins section:\n\nbuiltins:\n- remote_api: on\n\nThis will add remote_api serving to the path /_ah/remote_api.\n\nYou can also add it to your handlers section, e.g.:\n\nhandlers:\n- url: /remote_api(/.\\*)?\n\nscript: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py\n\nYou can use remote_api_stub to remotely access services exported by this\nhandler. See the documentation in remote_api_stub.py for details on how to do\nthis.\n\nThe handler supports several forms of authentication. By default, it\nchecks that the user is an admin using the Users API, similar to specifying\n\"login: admin\" in the app.yaml file. It also supports a 'custom header' mode\nwhich can be used in certain scenarios.\n\nTo configure the custom header mode, edit an appengine_config file (the same\none you may use to configure appstats) to include a line like this:\n\nremoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = (\n\n: 'HTTP_X_APPENGINE_INBOUND_APPID', \\['otherappid'\\] )\n\nSee the ConfigDefaults class below for the full set of options available.\n\nContents\n--------\n\n*class* google.appengine.ext.remote_api.handler.ApiCallHandler[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/remote_api/handler#ApiCallHandler)\n\n: Bases: google.appengine.ext.webapp._webapp25.RequestHandler\n\n A webapp handler that accepts API calls over HTTP and executes them. \n\n CheckIsAdmin()[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/remote_api/handler#ApiCallHandler.CheckIsAdmin)\n : \n\n ExecuteRequest(request)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/remote_api/handler#ApiCallHandler.ExecuteRequest)\n\n : Executes an API invocation and returns the response object.\n\n InfoPage()[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/remote_api/handler#ApiCallHandler.InfoPage)\n\n : Renders an information page.\n\n LOCAL_STUBS*= {'remote_datastore': \\\u003cgoogle.appengine.ext.remote_api.handler.RemoteDatastoreStub object\\\u003e}*\n : \n\n OAUTH_SCOPES*= \\['https://www.googleapis.com/auth/appengine.apis', 'https://www.googleapis.com/auth/cloud-platform'\\]*\n : \n\n get()[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/remote_api/handler#ApiCallHandler.get)\n\n : Handle a GET. Just show an info page.\n\n post()[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/remote_api/handler#ApiCallHandler.post)\n\n : Handle POST requests by executing the API call.\n\n*class* google.appengine.ext.remote_api.handler.ConfigDefaults[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/remote_api/handler#ConfigDefaults)\n\n: Bases: object\n\n Configurable constants.\n\n To override remote_api configuration values, define values like this\n in your appengine_config.py file (in the root of your app):\n\n remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = (\n\n : 'HTTP_X_APPENGINE_INBOUND_APPID', \\['otherappid'\\] )\n\n You may wish to base this file on sample_appengine_config.py. \n\n CUSTOM_ENVIRONMENT_AUTHENTICATION*= ()*\n: \n\n*class* google.appengine.ext.remote_api.handler.RemoteDatastoreStub(service='datastore_v3', _test_stub_map=None)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/remote_api/handler#RemoteDatastoreStub)\n\n: Bases: google.appengine.api.apiproxy_stub.APIProxyStub\n\n Provides a stub that permits execution of stateful datastore queries.\n\n Some operations aren't possible using the standard interface. Notably,\n datastore RunQuery operations internally store a cursor that is referenced in\n later Next calls, and cleaned up at the end of each request. Because every\n call to ApiCallHandler takes place in its own request, this isn't possible.\n\n To work around this, RemoteDatastoreStub provides its own implementation of\nRunQuery that immediately returns the query results. \n\ngoogle.appengine.ext.remote_api.handler.main()[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/remote_api/handler#main)\n:"]]