O Python 2 não é mais compatível com a comunidade. Recomendamos que você migre aplicativos do Python 2 para o Python 3.

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/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:



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 = ['https://www.googleapis.com/auth/appengine.apis', 'https://www.googleapis.com/auth/cloud-platform']

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



You may wish to base this file on sample_appengine_config.py.

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.