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 -- Triggers an OpenID login flow. If federated_identity is not specified, Google OpenID login will be used.

Returns

Login URL as a string. If federated_identity is set, the returned string represents a federated login that uses the specified identity. If federated_identity is not set, the login URL will use Google Accounts.

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 both federated login applications and 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 could be a Google Accounts user or a federated login user.

federated_identity and federated_provider are only avaliable for federated users.

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

Gets the user's federated identity.

Returns

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

federated_provider()source

Gets the user's federated provider.

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, part of the email address for some users, and the federated identity for federated users who have not asserted an email address.

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 -- Triggers an OpenID login flow. If federated_identity is not specified, Google OpenID login will be used.

Returns

Login URL as a string. If federated_identity is set, the returned string represents a federated login that uses the specified identity. If federated_identity is not set, the login URL will use Google Accounts.

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 both federated login applications and 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.

Send feedback about...

App Engine standard environment for Python