From bcd092cd2d84ccbf17c520d736d5c26d7dbea4e6 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Sun, 2 Jul 2023 19:14:05 +0530 Subject: [PATCH] Add API endpoint handling for `get_player_info()` --- api.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api.py b/api.py index 7c2923b..be1dcbf 100644 --- a/api.py +++ b/api.py @@ -14,6 +14,13 @@ def get_uuid(self, player_name: str) -> str: return content["id"] # API Retrieval Commands + def get_player_info(self, player_name: str) -> dict: + """Fetches data of a specific player, including game stats.""" + player_uuid = self.get_uuid(player_name) + api_request = requests.get(f"https://api.hypixel.net/player?key={self.api_key}&uuid={player_uuid}").content + player_data = json.loads(api_request) + return player_data + def get_auctions(self, page: int = 0) -> dict: """ Returns a `dict` of the 1000 latest auctions in Skyblock.