mirror of
https://github.com/ProtoThis/python-synology.git
synced 2026-01-16 15:09:03 +00:00
Add logout method (#79)
This commit is contained in:
@ -124,7 +124,7 @@ class SynologyDSM:
|
||||
"""Gets available API infos from the NAS."""
|
||||
return self._apis
|
||||
|
||||
def login(self, otp_code: str = None):
|
||||
def login(self, otp_code: str = None) -> bool:
|
||||
"""Create a logged session."""
|
||||
# First reset the session
|
||||
self._debuglog("Creating new session")
|
||||
@ -176,7 +176,13 @@ class SynologyDSM:
|
||||
self._information = SynoDSMInformation(self)
|
||||
self._information.update()
|
||||
|
||||
return True
|
||||
return result["success"]
|
||||
|
||||
def logout(self) -> bool:
|
||||
"""Log out of the session."""
|
||||
result = self.get(API_AUTH, "logout")
|
||||
self._session = None
|
||||
return result["success"]
|
||||
|
||||
@property
|
||||
def device_token(self) -> str:
|
||||
|
||||
@ -21,3 +21,5 @@ DSM_6_AUTH_LOGIN_2SA_OTP = {
|
||||
},
|
||||
"success": True,
|
||||
}
|
||||
|
||||
DSM_6_AUTH_LOGOUT = {"success": True}
|
||||
|
||||
Reference in New Issue
Block a user