From 593caa82ecf2bc7c0fc21eb6bfb83a923b58d614 Mon Sep 17 00:00:00 2001 From: Yoshihiro OKUMURA Date: Thu, 1 Jun 2023 16:52:41 +0900 Subject: [PATCH] keep up with folder auth api changes. --- mdrsclient/api/folder.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mdrsclient/api/folder.py b/mdrsclient/api/folder.py index d8a8783..103c170 100644 --- a/mdrsclient/api/folder.py +++ b/mdrsclient/api/folder.py @@ -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: