pytan3.auth_methods.
CommonMixin
(http_client, login_timeout=5, logout_timeout=5, expires_after=295, ver_check=True, lvl='info')[source]¶Bases: object
Shared methods common amongst all AuthMethod
.
__init__
(http_client, login_timeout=5, logout_timeout=5, expires_after=295, ver_check=True, lvl='info')[source]¶Constructor.
Parameters: |
|
---|
log
= None¶logging.Logger
– Log for this object.
from_store
(store, **kwargs)[source]¶Create an instance of this class from an pytan3.auth_store.AuthStore
.
Parameters: |
|
---|---|
Returns: |
http_client
¶Get the HTTP Client for this object.
Returns: | pytan3.http_client.HttpClient |
---|
token
¶Get a token.
Notes
If logged_in
is False, login()
to get one.
If expired
is True, login()
to get a new one.
If logged_in
is True, and last_used
is older than
revalidate_after
, validate()
to re-validate token.
If validate()
fails validation, login()
to get a new one.
Returns: | str |
---|
login
(**kwargs)[source]¶Send a login request to receive a token.
Parameters: | **kwargs –
|
---|---|
Raises: | exceptions.LoginError – If status code in response is not 200. |
Returns: | str |
logout
(**kwargs)[source]¶Send a logout request to revoke a token.
Parameters: | **kwargs – |
---|---|
Raises: |
|
Returns: | None |
logout_all
(**kwargs)[source]¶Send a logout request to revoke all tokens associated with this token.
Parameters: | **kwargs – |
---|---|
Raises: |
|
Returns: | None |
validate
(**kwargs)[source]¶Send a validate request to check that token is still valid.
Parameters: | **kwargs – |
---|---|
Raises: |
|
Returns: |
create_store
(**kwargs)[source]¶Create an instance of pytan3.auth_store.AuthStore
from this object.
Returns: | pytan3.auth_store.AuthStore |
---|