def _maybe_call_get_oauth_user(_scope=None):
 if (('OAUTH_ERROR_CODE' not in os.environ) or (os.environ.get('OAUTH_LAST_SCOPE', None) != _scope)):
  req = user_service_pb.GetOAuthUserRequest()
  if _scope:
   req.set_scope(_scope)
  resp = user_service_pb.GetOAuthUserResponse()
  try:
   apiproxy_stub_map.MakeSyncCall('user', 'GetOAuthUser', req, resp)
   os.environ['OAUTH_EMAIL'] = resp.email()
   os.environ['OAUTH_AUTH_DOMAIN'] = resp.auth_domain()
   os.environ['OAUTH_USER_ID'] = resp.user_id()
   os.environ['OAUTH_CLIENT_ID'] = resp.client_id()
   if resp.is_admin():
    os.environ['OAUTH_IS_ADMIN'] = '1'
   else:
    os.environ['OAUTH_IS_ADMIN'] = '0'
   os.environ['OAUTH_ERROR_CODE'] = ''
  except apiproxy_errors.ApplicationError as e:
   os.environ['OAUTH_ERROR_CODE'] = str(e.application_error)
   os.environ['OAUTH_ERROR_DETAIL'] = e.error_detail
  if _scope:
   os.environ['OAUTH_LAST_SCOPE'] = _scope
  else:
   os.environ.pop('OAUTH_LAST_SCOPE', None)
 _maybe_raise_exception()

def _maybe_call_get_oauth_user ( _scope = None ) : if ( ( 'OAUTH_ERROR_CODE' not in os . environ ) or ( os . environ . get ( 'OAUTH_LAST_SCOPE' , None ) != _scope ) ) : req = user_service_pb . GetOAuthUserRequest ( ) if _scope : req . set_scope ( _scope ) resp = user_service_pb . GetOAuthUserResponse ( ) try : apiproxy_stub_map . MakeSyncCall ( 'user' , 'GetOAuthUser' , req , resp ) os . environ [ 'OAUTH_EMAIL' ] = resp . email ( ) os . environ [ 'OAUTH_AUTH_DOMAIN' ] = resp . auth_domain ( ) os . environ [ 'OAUTH_USER_ID' ] = resp . user_id ( ) os . environ [ 'OAUTH_CLIENT_ID' ] = resp . client_id ( ) if resp . is_admin ( ) : os . environ [ 'OAUTH_IS_ADMIN' ] = '1' else : os . environ [ 'OAUTH_IS_ADMIN' ] = '0' os . environ [ 'OAUTH_ERROR_CODE' ] = '' except apiproxy_errors . ApplicationError as e : os . environ [ 'OAUTH_ERROR_CODE' ] = str ( e . application_error ) os . environ [ 'OAUTH_ERROR_DETAIL' ] = e . error_detail if _scope : os . environ [ 'OAUTH_LAST_SCOPE' ] = _scope else : os . environ . pop ( 'OAUTH_LAST_SCOPE' , None ) _maybe_raise_exception ( )
makes an getoauthuser rpc and stores the results in os .