Skip to main content

SkyHelper-Networth-Python

pypi python version license stars

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.

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 skyhelper-networth

Or using uv:

uv add skyhelper-networth

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(
            "https://api.hypixel.net/v2/skyblock/profiles",
            headers=headers,
            params={"uuid": uuid},
        ) as response:
            profiles = await response.json()
        async with session.get(
            "https://api.hypixel.net/v2/skyblock/museum",
            headers=headers,
            params={"profile": profile_id},
        ) 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)
        # In some cases, the balance may not be present in the profile data.
        balance = profile.get("banking", {}).get("balance", 0)
        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()

Methods like get_networth and get_non_cosmetic_networth will only work within the context manager or as long as the session is open.

Other calculators are available, such as PetCalculator or SkyBlockItemCalculator, 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.

Metadata

Release files for skyhelper-networth 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for skyhelper-networth 0.0.4
File Size Uploaded
skyhelper_networth-0.0.4.tar.gz 33.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for skyhelper-networth 0.0.4
File Interpreter ABI Platform
skyhelper_networth-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 99.4 kB

Release files / skyhelper_networth-0.0.4.tar.gz

Download URL skyhelper_networth-0.0.4.tar.gz
Size 33.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e38652f78b5829da1270f74760d5ba1da340712db226f85d91ef95fb2869c607
BLAKE2b-256 checksum
How to use checksums
88c3e31cd1d23ccf0bb51370a7e701a0c503a892eb2e7a219191fddd5ad176f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.24.1","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / skyhelper_networth-0.0.4-py3-none-any.whl

Download URL skyhelper_networth-0.0.4-py3-none-any.whl
Size 65.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b26d0adfafe6d4271526d1b3d179d5dacf71a9445fbbfc467eb93791a37fc9b
BLAKE2b-256 checksum
How to use checksums
f80a99519430a1c28039549e50fa82f7e5d1a79791fe0fa88df6e00522023f9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.24.1","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page