feat: add is_logged method
This commit is contained in:
@@ -5,12 +5,12 @@ from skywipe.configure import Configuration
|
|||||||
|
|
||||||
|
|
||||||
class Auth:
|
class Auth:
|
||||||
def __init__(self, configuration: Configuration = None):
|
def __init__(self):
|
||||||
self.configuration = configuration or Configuration()
|
self.config = Configuration()
|
||||||
self.client: Client = None
|
self.client = None
|
||||||
|
|
||||||
def login(self) -> Client:
|
def login(self) -> Client:
|
||||||
config_data = self.configuration.load()
|
config_data = self.config.load()
|
||||||
|
|
||||||
handle = config_data.get("handle")
|
handle = config_data.get("handle")
|
||||||
password = config_data.get("password")
|
password = config_data.get("password")
|
||||||
@@ -23,3 +23,6 @@ class Auth:
|
|||||||
self.client.login(handle, password)
|
self.client.login(handle, password)
|
||||||
|
|
||||||
return self.client
|
return self.client
|
||||||
|
|
||||||
|
def is_logged(self) -> bool:
|
||||||
|
return bool(getattr(self.client, "me", None))
|
||||||
|
|||||||
Reference in New Issue
Block a user