SkyHelper's Networth Calculation for Hypixel SkyBlock rewritten in Python
Project description
SkyHelper-Networth-Python
SkyHelper's Networth Calculation as a Python package to calculate a player's SkyBlock networth by using their profile data provided by the Hypixel API.
[!NOTE] This project is not affiliated with SkyHelper or Hypixel in any way. Do not report issues regarding this package to them. However, feel free to open an issue here.
Installation
You can install the package using pip:
pip install git+https://codeberg.org/Zalko/SkyHelper-Networth-Python.git
Or using uv:
uv add git+https://codeberg.org/Zalko/SkyHelper-Networth-Python.git
Quick Start
This package was designed to be used asynchronously, you should use an async HTTP client to fetch
the profile and museum data from the Hypixel API. It
uses aiohttp internally to make its API calls (to get current
prices from SkyHelper prices repo and item information from Hypixel API). The following example
demonstrates how to use the ProfileNetworthCalculator to calculate a player's networth while
reusing the existing ClientSession:
import asyncio
from aiohttp import ClientSession
from skyhelper_networth import ProfileNetworthCalculator
uuid = ""
profile_id = ""
hypixel_api_key = ""
headers = {"API-Key": hypixel_api_key}
async def main():
async with ClientSession() as session:
async with session.get(f"https://api.hypixel.net/v2/skyblock/profiles?uuid={uuid}", headers=headers) as response:
profiles = await response.json()
async with session.get(f"https://api.hypixel.net/v2/skyblock/museum?profile={profile_id}", headers=headers) as response:
museum = await response.json()
profile = next(profile for profile in profiles.get("profiles") if profile.get("profile_id") == profile_id)
user_profile = profile.get("members").get(uuid)
balance = profile.get("banking").get("balance")
museum_data = museum.get("members").get(uuid)
calculator = ProfileNetworthCalculator(user_profile, museum_data, balance, session=session)
networth = await calculator.get_networth()
non_cosmetic_networth = await calculator.get_non_cosmetic_networth()
print("Networth:", networth)
print("Non-Cosmetic Networth:", non_cosmetic_networth)
asyncio.run(main())
If you do not wish to provide a session, you can use ProfileNetworthCalculator as an asynchronous
context manager, which will handle the session internally. It is not recommended as it will create a
new session for each instance of the calculator.
async with ProfileNetworthCalculator(user_profile, museum_data, balance) as calculator:
networth = await calculator.get_networth()
[!IMPORTANT] Methods like
get_networthandget_non_cosmetic_networthwill only work within the context manager or as long as the session is open.
[!NOTE] Other calculators are available, such as
BasicItemCalculatororSkyBlockItemCalculator, which can be used to calculate the networth of a single item.
Contributing
Contributions are welcome!
The project uses uv for development, you can set up your
environment with:
uv sync
Pre-commit Hooks
You can use prek for pre-commit hooks. It will notably run pyproject-fmt, Ruff and ty. Check out prek.toml for the full configuration.
uv run prek
You can install the pre-commit hooks so that it runs automatically before each commit with the following command:
uv run prek install
Testing
You can run the tests using unittest:
uv run -m unittest
Credits
Huge thanks to Altpapier for creating SkyHelper-Networth. This project would not have been possible without their work.
I would also like to thank DuckySoLucky for doing a Go implementation of the Node.js module, SkyHelper-Networth-Go, which helped me understand the structure and logic of the original code. It served as a great reference to correctly type the code.
Again, this project is not affiliated with either of them.
License
This project is licensed under the MIT License. See the LICENSE file for details.
The NBT parsing code is based on PyNBT by Tyler Kennedy, which is also licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file skyhelper_networth-0.0.1a0.tar.gz.
File metadata
- Download URL: skyhelper_networth-0.0.1a0.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4134b9c6db888f5a148c569829e37487b1fa70afd5e1c55aa93891922398c552
|
|
| MD5 |
a8fdd6fa3806861eefff8dcc9655a273
|
|
| BLAKE2b-256 |
b8dcd0d64c5338d860b4152c2c29d5091d5de1478332a701f849b2ac817e702d
|
File details
Details for the file skyhelper_networth-0.0.1a0-py3-none-any.whl.
File metadata
- Download URL: skyhelper_networth-0.0.1a0-py3-none-any.whl
- Upload date:
- Size: 34.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f37a1fd8695bcd64cd96d5ef33bd6c7acabb99da0bfc157c5e2cd353b8275d13
|
|
| MD5 |
390c7050025861ae9e9809bba65a2b3d
|
|
| BLAKE2b-256 |
46cd27372e9955c692ec1a5d41c122aec4e4ab7f8cff319b6534ec9682a46f25
|