Skip to content

Commit ec2c2b2

Browse files
authored
Merge pull request #5 from PyBotDevs/new-api-endpoint-functions
Add API endpoint request functions for getting data on Skyblock items, mayor information and ongoing election information
2 parents 1053cc2 + d6ec39b commit ec2c2b2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

api.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,29 @@ def get_skills(self):
7474
api_request = requests.get("https://api.hypixel.net/resources/skyblock/skills").content
7575
collections_data = json.loads(api_request)
7676
return collections_data
77+
78+
def get_items(self):
79+
"""
80+
Returns a `dict` of information related to Skyblock items.
81+
"""
82+
api_request = requests.get("https://api.hypixel.net/resources/skyblock/items").content
83+
items_data = json.loads(api_request)
84+
return items_data
85+
86+
def get_mayor_information(self):
87+
"""
88+
Returns a `dict` of information regarding the current mayor in Skyblock.
89+
"""
90+
api_request = requests.get("https://api.hypixel.net/resources/skyblock/election").content
91+
mayor_info = json.loads(api_request)
92+
del mayor_info["current"]
93+
return mayor_info
94+
95+
def get_current_election(self):
96+
"""
97+
Returns a `dict` of information regarding the current election in Skyblock.
98+
"""
99+
api_request = requests.get("https://api.hypixel.net/resources/skyblock/election").content
100+
election_info = json.loads(api_request)
101+
del election_info["mayor"]
102+
return election_info

0 commit comments

Comments
 (0)