From d6ec39bd81e011f29c0f479b5074d1de3aafc908 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Sat, 31 Dec 2022 15:31:04 +0530 Subject: [PATCH] Add API endpoint request functions for getting data on Skyblock items, mayor information and ongoing election information --- api.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/api.py b/api.py index ca08989..2472ff6 100644 --- a/api.py +++ b/api.py @@ -74,3 +74,29 @@ def get_skills(self): api_request = requests.get("https://api.hypixel.net/resources/skyblock/skills").content collections_data = json.loads(api_request) return collections_data + + def get_items(self): + """ + Returns a `dict` of information related to Skyblock items. + """ + api_request = requests.get("https://api.hypixel.net/resources/skyblock/items").content + items_data = json.loads(api_request) + return items_data + + def get_mayor_information(self): + """ + Returns a `dict` of information regarding the current mayor in Skyblock. + """ + api_request = requests.get("https://api.hypixel.net/resources/skyblock/election").content + mayor_info = json.loads(api_request) + del mayor_info["current"] + return mayor_info + + def get_current_election(self): + """ + Returns a `dict` of information regarding the current election in Skyblock. + """ + api_request = requests.get("https://api.hypixel.net/resources/skyblock/election").content + election_info = json.loads(api_request) + del election_info["mayor"] + return election_info