From 34c0e3ca9fd7418498e6d4edeb2cb7b9087150d9 Mon Sep 17 00:00:00 2001 From: Miwory Date: Wed, 26 Nov 2025 14:13:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D0=BE=D0=B4:=20get=5Fscore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- src/osuclient/api.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a398863..04104df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "osuclient" -version = "0.4.1" +version = "0.5.0" description = "Client for osu! API" readme = "README.md" authors = [ diff --git a/src/osuclient/api.py b/src/osuclient/api.py index ee885a2..b68de66 100644 --- a/src/osuclient/api.py +++ b/src/osuclient/api.py @@ -47,6 +47,26 @@ class osuAPIClient(AioHTTPXClient): case _: raise s.Error(500, 'Internal Server Error') + async def get_score(self, access_token: str, score_id: int): + req = await self.get( + f'/scores/{score_id}', + headers=self.clean_dict( + { + 'Authorization': f'Bearer {access_token}', + } + ), + ) + + match req.status_code: + case st.OK: + return s.Score.model_validate(req.json()) + + case st.NOT_FOUND: + raise s.Error(404, 'Score not found') + + case _: + raise s.Error(500, 'Internal Server Error') + async def get_user_scores( self, access_token: str,