auth module
Authenticates with D2S.
Source code in d2spy/auth.py
__init__(base_url)
¶
Constructor for Auth class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
Base URL for D2S instance. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
Raised if unable to communicate with host. |
Source code in d2spy/auth.py
get_current_user()
¶
Get user object for logged in user.
Returns:
Type | Description |
---|---|
Optional[User]
|
Optional[User]: User object or None. |
Source code in d2spy/auth.py
login(email=None, password=None)
¶
Login to D2S platform with email and password. Alternatively, use
environment variables D2S_EMAIL
and D2S_PASSWORD
to set email and password.
If the password is not passed as an argument and D2S_PASSWORD
is not set,
getpass
will be used to prompt user for password.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
email
|
Optional[str]
|
Email address used to sign in to D2S. |
None
|
password
|
Optional[str]
|
Password used to sign in to D2S. |
None
|
Returns:
Type | Description |
---|---|
Optional[D2SpySession]
|
Optional[D2SpySession]: Session with user access cookie. |