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.

CheckIsAdmin()source
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

Send feedback about...

App Engine standard environment for Python