google.appengine.api.users module¶
Python datastore class User to be used as a datastore data type.
- Classes defined here:
- User: object representing a user. A user could be a Google Accounts user
- or a federated user.
Error: base exception type UserNotFoundError: UserService exception RedirectTooLongError: UserService exception NotAllowedError: UserService exception
-
google.appengine.api.users.
CreateLoginURL
(dest_url=None, _auth_domain=None, federated_identity=None)¶ Computes the login URL for redirection.
- Args:
- dest_url: String that is the desired final destination URL for the user
- once login is complete. If ‘dest_url’ does not have a host specified, we will use the host from the current request.
- federated_identity: federated_identity is used to trigger OpenId Login
- flow, an empty value will trigger Google OpenID Login by default.
- Returns:
- Login URL as a string. If federated_identity is set, this will be a federated login using the specified identity. If not, this will use Google Accounts.
-
google.appengine.api.users.
CreateLogoutURL
(dest_url, _auth_domain=None)¶ - Computes the logout URL for this request and specified destination URL,
- for both federated login App and Google Accounts App.
- Args:
- dest_url: String that is the desired final destination URL for the user
- once logout is complete. If ‘dest_url’ does not have a host specified, we will use the host from the current request.
- Returns:
- Logout URL as a string
-
exception
google.appengine.api.users.
Error
[source]¶ Bases:
exceptions.Exception
Base User error type.
-
google.appengine.api.users.
GetCurrentUser
()¶
-
google.appengine.api.users.
IsCurrentUserAdmin
()¶ Return true if the user making this request is an admin for this application, false otherwise.
We specifically make this a separate function, and not a member function of the User class, because admin status is not persisted in the datastore. It only exists for the user making this request right now.
-
exception
google.appengine.api.users.
NotAllowedError
[source]¶ Bases:
google.appengine.api.users.Error
Raised by UserService calls if the requested redirect URL is not allowed.
-
exception
google.appengine.api.users.
RedirectTooLongError
[source]¶ Bases:
google.appengine.api.users.Error
Raised by UserService calls if 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
A user.
We provide the email address, nickname, and id for a user.
A nickname is a human-readable string which uniquely identifies a Google user, akin to a username. It will be an email address for some users, but not all.
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]¶ Return this user’s auth domain.
This method is internal and should not be used by client applications.
-
nickname
()[source]¶ Return this 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.
-
-
exception
google.appengine.api.users.
UserNotFoundError
[source]¶ Bases:
google.appengine.api.users.Error
Raised by User.__init__() when there’s no email argument 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.
- Args:
- dest_url: String that is the desired final destination URL for the user
- once login is complete. If ‘dest_url’ does not have a host specified, we will use the host from the current request.
- federated_identity: federated_identity is used to trigger OpenId Login
- flow, an empty value will trigger Google OpenID Login by default.
- Returns:
- Login URL as a string. If federated_identity is set, this will be a federated login using the specified identity. If not, this will use Google Accounts.
-
google.appengine.api.users.
create_logout_url
(dest_url, _auth_domain=None)[source]¶ - Computes the logout URL for this request and specified destination URL,
- for both federated login App and Google Accounts App.
- Args:
- dest_url: String that is the desired final destination URL for the user
- once logout is complete. If ‘dest_url’ does not have a host specified, we will use the host from the current request.
- Returns:
- Logout URL as a string
-
google.appengine.api.users.
is_current_user_admin
()[source]¶ Return true if the user making this request is an admin for this application, false otherwise.
We specifically make this a separate function, and not a member function of the User class, because admin status is not persisted in the datastore. It only exists for the user making this request right now.