google.appengine.ext.remote_api.handler module


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/

You can use remote_api_stub to remotely access services exported by this handler. See the documentation in 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:



See the ConfigDefaults class below for the full set of options available.


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.


Executes an API invocation and returns the response object.


Renders an information page.

LOCAL_STUBS = {'remote_datastore': <google.appengine.ext.remote_api.handler.RemoteDatastoreStub object>}
OAUTH_SCOPES = ['', '']

Handle a GET. Just show an info page.


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 file (in the root of your app):



You may wish to base this file on

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.


Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

App Engine standard environment for Python