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 available in preview.

google.appengine.api.app_identity.app_identity_stub_base.AppIdentityServiceStubBase

A base class for the AppIdentityService API stub.

Inherits From: APIProxyStub, expected_type

Offers base implementations for following AppIdentityService RPCs:

  • AppIdentityService::SignForApp -> _Dynamic_SignForApp
  • AppIdentityService::GetPublicCertificatesForApp -> _Dynamic_GetPublicCertificatesForApp
  • AppIdentityService::GetServiceAccountName -> _Dynamic_GetServiceAccountName
  • AppIdentityService::GetDefaultGcsBucketName -> _Dynamic_GetDefaultGcsBucketName
  • AppIdentityStubService::SetDefaultGcsBucketName -> _Dynamic_SetDefaultGcsBucketName
  • AppIdentityService::GetAccessToken -> _Dynamic_GetAccessToken

And provides following helpers:

  • SetDefaultGcsBucketName: set default bucket name from the request if possible, set from APP_DEFAULT_GCS_BUCKET_NAME constant otherwise.
  • Clear: Reset state of the stub.

Not implemented and must be implemented in an inherited class:

  • Create: static method, create a stub.

Methods

Clear

View source

Resets the state on the App Identity stub.

Create

View source

CreateRPC

View source

Creates RPC object instance.

Returns
An instance of RPC.

MakeSyncCall

View source

The main RPC entry point.

Args
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.

SetDefaultGcsBucketName

View source

SetError

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.

Args
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.

get_service_account_name

View source

get_service_account_token

View source

test implementation for _metadata_server.get_service_account_token.

This API returns an invalid token, as the dev_appserver does not have access to an actual service account. Subclasses override this function with more useful implementations.

Args
scopes a list of oauth2 scopes.
service_account the service account to get the token for

Returns
Tuple of access token and expiration time in epoch

THREADSAFE True