Skip to content

Commit 17038d5

Browse files
authored
Merge pull request #23 from PyBotDevs/add-example-code-in-readme
Add some example code to README
2 parents b2e4dbf + bd4e874 commit 17038d5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![CodeFactor](https://www.codefactor.io/repository/github/pybotdevs/skyblockpy/badge)](https://www.codefactor.io/repository/github/pybotdevs/skyblockpy)
44

55

6+
## About
67
### What is SkyblockPy?
78
SkyblockPy is a simple Python API wrapper which is used to communicate and fetch data from the Hypixel Skyblock API endpoints.
89
It is based on the Python requests library, which makes it very simple to develop for and fix issues.
@@ -12,9 +13,40 @@ SkyblockPy works by communicating with the Hypixel API endpoints by using your *
1213

1314
If no errors are returned by the API endpoint (status code 200 is returned), then the API output is returned as a `dict`.
1415

16+
## Setup and Usage
1517
### Obtaining an API key
1618
Go to the Hypixel Minecraft Java server and use `/api` command.
1719

20+
### Example Implementation of SkyblockPy
21+
Here's an example snippet of retrieving the third page of the latest Skyblock auctions.
22+
23+
```py
24+
import skyblockpy
25+
26+
skyblock = skyblockpy.Skyblock("api_key") # Initialize the Skyblock class with a prospective Hypixel API key.
27+
28+
def latest_auctions_raw() -> dict: # Make a function for returning API output, and highlight return output type as dict.
29+
output = skyblock.get_auctions(page=3) # Gets the API response, and returns the third page of contents.
30+
return output
31+
32+
latest_auctions_raw() # Run the actual function now.
33+
```
34+
35+
Here's another example snippet on getting information on a player in Hypixel.
36+
37+
```py
38+
import skyblockpy
39+
40+
skyblock = skyblockpy.Skyblock("api_key") # Initialize the Skyblock class with a prospective Hypixel API key.
41+
42+
def get_player_info() -> dict: # Make a function for returning API output, and highlight return output type as dict.
43+
output = skyblock.get_player_info("notsniped") # Gets an API response on player info for a user "notsniped".
44+
return output
45+
46+
get_player_info() # Run the actual function.
47+
```
48+
49+
## Extra
1850
### I found a bug/I want to add a missing feature!
1951
Just make a new issue [here](https://github.com/PyBotDevs/skyblockpy/issues/new) and describe the bug/feature.
2052

0 commit comments

Comments
 (0)