add -p option for support to open PW_OPEN folder.

This commit is contained in:
2023-05-10 20:10:43 +09:00
parent 97007233c6
commit 995e4cc467
7 changed files with 34 additions and 8 deletions

View File

@ -5,6 +5,7 @@ from pydantic.dataclasses import dataclass
from mdrsclient.api.base import BaseApi
from mdrsclient.api.utils import token_check
from mdrsclient.exceptions import UnauthorizedException
from mdrsclient.models import Folder, FolderSimple
@ -67,6 +68,19 @@ class FolderApi(BaseApi):
self._raise_response_error(response)
return True
def auth(self, id: str, password: str) -> bool:
# print(self.__class__.__name__ + "::" + sys._getframe().f_code.co_name)
url = self.ENTRYPOINT + id + "/auth/"
data = {"password": password}
token_check(self.connection)
response = self.connection.post(url, data=data)
# stupid! always returned status code 200
self._raise_response_error(response)
data = response.json()
if data.get("status") is not True:
raise UnauthorizedException("Password is incorrect.")
return True
def move(self, folder: FolderSimple, folder_id: str) -> bool:
# print(self.__class__.__name__ + "::" + sys._getframe().f_code.co_name)
url = self.ENTRYPOINT + folder.id + "/move/"