Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

Python 3.10 is now generally available.


Base class for implementing API proxy stub classes.

Inherits From: APIProxyStub, expected_type

To implement an API proxy stub:

  • Extend this class.
  • Override __init__ to pass in appropriate default service name.
  • Implement service methods as _Dynamic_<method>(request, response).

service_name Service name expected for all calls.
max_request_size int. Maximum allowable size of the incoming request. An apiproxy_errors.RequestTooLargeError will be raised if the inbound request exceeds this size. Default is 1 MB. Subclasses can override it.
request_data A request_info.RequestInfo instance used to look up state associated with the request that generated an API call.



View source

Creates RPC object instance.

An instance of RPC.


View source

The main RPC entry point.

service Must be name as provided to service_name of constructor.
call A string representing the rpc to make. Must be part of the underlying services methods and impemented by _Dynamic_<call>.
request A protocol buffer of the type corresponding to call.
response A protocol buffer of the type corresponding to call.
request_id A unique string identifying the request associated with the API call.


View source

Set an error condition that may be raised when calls made to stub.

If a method is specified, the error will only apply to that call. The error rate is applied to the method specified or all calls if method is not set.

error An instance of apiproxy_errors.Error or None for no error.
method A string representing the method that the error will affect.
error_rate a number from [0, 1] that sets the chance of the error, defaults to 1.