keep up with folder auth api changes.

This commit is contained in:
Yoshihiro OKUMURA 2023-06-01 16:52:41 +09:00
parent 1a0a26d7b3
commit 593caa82ec
Signed by: orrisroot
GPG Key ID: 470AA444C92904B2

View File

@ -1,5 +1,6 @@
from typing import Final
import requests
from pydantic import parse_obj_as
from pydantic.dataclasses import dataclass
@ -75,11 +76,9 @@ class FolderApi(BaseApi):
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:
if response.status_code == requests.codes.unauthorized:
raise UnauthorizedException("Password is incorrect.")
self._raise_response_error(response)
return True
def acl(self, id: str, access_level: int, recursive: bool, password: str | None) -> bool: