parameters: (self, refresh=False)
docstring: Get an authentication token.
  
      The token is cached in memcache, keyed by the scopes argument.
  
      Args:
        refresh: If True, ignore a cached token; default False.
  
      Returns:
        An authentication token.
docstring_summary: Get an authentication token.
docstring_tokens: Get an authentication token .
function: def get_token_async(self, refresh=False):
      """Get an authentication token.
  
      The token is cached in memcache, keyed by the scopes argument.
  
      Args:
        refresh: If True, ignore a cached token; default False.
  
      Returns:
        An authentication token.
      """
      if self.token is not None and not refresh:
        raise ndb.Return(self.token)
      key = '%s,%s' % (self.service_account_id, ','.join(self.scopes))
      ts = yield _AE_TokenStorage_.get_by_id_async(
          key, use_cache=True, use_memcache=True,
          use_datastore=self.retry_params.save_access_token)
      if ts is None or ts.expires < (time.time() +
                                     self._TOKEN_EXPIRATION_HEADROOM):
        token, expires_at = yield self.make_token_async(
            self.scopes, self.service_account_id)
        timeout = int(expires_at - time.time())
        ts = _AE_TokenStorage_(id=key, token=token, expires=expires_at)
        if timeout > 0:
          yield ts.put_async(memcache_timeout=timeout,
                             use_datastore=self.retry_params.save_access_token,
                             use_cache=True, use_memcache=True)
      self.token = ts.token
      raise ndb.Return(self.token)
function_tokens: def get_token_async ( self , refresh = False ) : if self . token is not None and not refresh : raise ndb . Return ( self . token ) key = '%s,%s' % ( self . service_account_id , ',' . join ( self . scopes ) ) ts = yield _AE_TokenStorage_ . get_by_id_async ( key , use_cache = True , use_memcache = True , use_datastore = self . retry_params . save_access_token ) if ts is None or ts . expires < ( time . time ( ) + self . _TOKEN_EXPIRATION_HEADROOM ) : token , expires_at = yield self . make_token_async ( self . scopes , self . service_account_id ) timeout = int ( expires_at - time . time ( ) ) ts = _AE_TokenStorage_ ( id = key , token = token , expires = expires_at ) if timeout > 0 : yield ts . put_async ( memcache_timeout = timeout , use_datastore = self . retry_params . save_access_token , use_cache = True , use_memcache = True ) self . token = ts . token raise ndb . Return ( self . token )