google.appengine.api.users module

Summary

The User Python datastore class to be used as a datastore data type.

Contents

google.appengine.api.users.CreateLoginURL(dest_url=None, _auth_domain=None, federated_identity=None)source

Computes the login URL for redirection.

Parameters
  • dest_url – String that is the desired final destination URL for the user once login is complete. If dest_url does not specify a host, the host from the current request is used.

  • federated_identity – Decommissioned, don’t use. Setting this to a non-None value raises a NotAllowedError

Returns

Login URL as a string. The login URL will use Google Accounts.

Raises

NotAllowedError – If federated_identity is not None.

google.appengine.api.users.CreateLogoutURL(dest_url, _auth_domain=None)source

Computes the logout URL and specified destination URL for the request.

This function works for Google Accounts applications.

Parameters

dest_url – String that is the desired final destination URL for the user after the user has logged out. If dest_url does not specify a host, the host from the current request is used.

Returns

Logout URL as a string.

exception google.appengine.api.users.Errorsource

Bases: exceptions.Exception

Base User error type.

google.appengine.api.users.GetCurrentUser()source

Retrieves information associated with the user that is making a request.

Returns:

google.appengine.api.users.IsCurrentUserAdmin()source

Specifies whether the user making a request is an application admin.

Because administrator status is not persisted in the datastore, is_current_user_admin() is a separate function rather than a member function of the User class. The status only exists for the user making the current request.

Returns

True if the user is an administrator; all other user types return False.

exception google.appengine.api.users.NotAllowedErrorsource

Bases: google.appengine.api.users.Error

The requested redirect URL is not allowed.

exception google.appengine.api.users.RedirectTooLongErrorsource

Bases: google.appengine.api.users.Error

The generated redirect URL was too long.

class google.appengine.api.users.User(email=None, _auth_domain=None, _user_id=None, federated_identity=None, federated_provider=None, _strict_mode=True)source

Bases: object

Provides the email address, nickname, and ID for a user.

A nickname is a human-readable string that uniquely identifies a Google user, akin to a username. For some users, this nickname is an email address, but for other users, a different nickname is used.

A user is a Google Accounts user.

federated_identity and federated_provider are decommissioned and should not be used.

auth_domain()source

Obtains the user’s authentication domain.

Returns

A string containing the authentication domain. This method is internal and should not be used by client applications.

email()source

Returns the user’s email address.

federated_identity()source

Decommissioned, don’t use.

Returns

A string containing the federated identity of the user. If the user is not a federated user, None is returned.

federated_provider()source

Decommissioned, don’t use.

Returns

A string containing the federated provider. If the user is not a federated user, None is returned.

nickname()source

Returns the user’s nickname.

The nickname will be a unique, human readable identifier for this user with respect to this application. It will be an email address for some users, and part of the email address for some users.

Returns

The nickname of the user as a string.

user_id()source

Obtains the user ID of the user.

Returns

A permanent unique identifying string or None. If the email address was set explicity, this will return None.

exception google.appengine.api.users.UserNotFoundErrorsource

Bases: google.appengine.api.users.Error

No email argument was specified, and no user is logged in.

google.appengine.api.users.create_login_url(dest_url=None, _auth_domain=None, federated_identity=None)source

Computes the login URL for redirection.

Parameters
  • dest_url – String that is the desired final destination URL for the user once login is complete. If dest_url does not specify a host, the host from the current request is used.

  • federated_identity – Decommissioned, don’t use. Setting this to a non-None value raises a NotAllowedError

Returns

Login URL as a string. The login URL will use Google Accounts.

Raises

NotAllowedError – If federated_identity is not None.

google.appengine.api.users.create_logout_url(dest_url, _auth_domain=None)source

Computes the logout URL and specified destination URL for the request.

This function works for Google Accounts applications.

Parameters

dest_url – String that is the desired final destination URL for the user after the user has logged out. If dest_url does not specify a host, the host from the current request is used.

Returns

Logout URL as a string.

google.appengine.api.users.get_current_user()source

Retrieves information associated with the user that is making a request.

Returns:

google.appengine.api.users.is_current_user_admin()source

Specifies whether the user making a request is an application admin.

Because administrator status is not persisted in the datastore, is_current_user_admin() is a separate function rather than a member function of the User class. The status only exists for the user making the current request.

Returns

True if the user is an administrator; all other user types return False.