auth module
Authenticates with D2S.
Source code in d2spy/auth.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
__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, skip_env=False)
¶
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
|
skip_env
|
bool
|
Skip checking environment variables for password. |
False
|
Returns:
Type | Description |
---|---|
Optional[D2SpySession]
|
Optional[D2SpySession]: Session with user access cookie. |