diff --git a/src/delta_barth/api/common.py b/src/delta_barth/api/common.py index c42e32b..26d9c0b 100644 --- a/src/delta_barth/api/common.py +++ b/src/delta_barth/api/common.py @@ -168,8 +168,6 @@ class Session: response: LoginResponse status: Status if resp.status_code == 200: - # TODO use to check for catching unknown exceptions - # response = LoginResponse(**resp.json()) response = LoginResponse(token=self.session_token) status = STATUS_HANDLER.SUCCESS elif resp.status_code == 401: @@ -197,13 +195,6 @@ def validate_credentials( ) -# def _assert_login_status() -> None: -# if not CURRENT_SESSION.logged_in: -# raise ApiConnectionError("Curent session is not logged in") -# assert login: -# doing request to defined end point which - - def _strip_url_components(string: str) -> str: return re.sub(r"^[ /]+|[ /]+$", "", string) @@ -244,63 +235,3 @@ class LoginRequest(BaseModel): class LoginResponse(BaseModel): token: str - - -# def login( -# base_url: str, -# user_name: str, -# password: str, -# database: str, -# mandant: str, -# ) -> tuple[LoginResponse, Status]: -# ROUTE: Final[str] = "user/login" -# URL: Final = combine_route(base_url, ROUTE) - -# login_req = LoginRequest( -# userName=user_name, -# password=password, -# databaseName=database, -# mandantName=mandant, -# ) -# resp = requests.put( -# URL, -# login_req.model_dump_json(), -# headers=CURRENT_SESSION.headers, # type: ignore -# ) - -# response: LoginResponse -# status: Status -# if resp.status_code == 200: -# response = LoginResponse(**resp.json()) -# status = STATE_HANDLER.pipe_states.SUCCESS -# CURRENT_SESSION.add_session_token(response.token) -# else: -# response = LoginResponse(token="") -# err = DelBarApiError(status_code=resp.status_code, **resp.json()) -# status = STATE_HANDLER.api_error(err) - -# return response, status - - -# ** logout -# def logout( -# base_url: str, -# ) -> tuple[None, Status]: -# ROUTE: Final[str] = "user/logout" -# URL: Final = combine_route(base_url, ROUTE) - -# resp = requests.put( -# URL, -# headers=CURRENT_SESSION.headers, # type: ignore -# ) - -# response = None -# status: Status -# if resp.status_code == 200: -# status = STATE_HANDLER.SUCCESS -# CURRENT_SESSION.remove_session_token() -# else: -# err = DelBarApiError(status_code=resp.status_code, **resp.json()) -# status = STATE_HANDLER.api_error(err) - -# return response, status