Skip to content

seriaati/hakushin-py

Repository files navigation

hakushin-py

Quick links

Developing something for Hoyoverse games? Here's a collection of Python async API wrappers for Hoyoverse games made by me:

  • enka.py is an Enka Network API wrapper for fetching in-game showcase.
  • yatta.py is a Project Yatta API wrapper for fetching Honkai Star Rail game data.
  • ambr.py is a Project Ambr API wrapper for fetching Genshin Impact game data.
  • hakushin.py is a Hakushin API wrapper for fetching Genshin Impact and Honkai Star Rail beta game data.

Introduction

hakushin-py is an async API wrapper for hakush.in written in Python.
Hakush.in is a website that displays beta game data for Genshin Impact and Honkai Star Rail.

Note: I am not the developer of hakush.in

Important Note

This wrapper does not support all endpoints from hakush.in, it is mainly focused on fetching the beta game data.
This means I selectively chose the endpoints and API fields that I personally think are useful for theorycrafting.
If you want a more complete wrapper for game data, use ambry.py and yatta.py instead.

Features

  • Fully typed.
  • Fully asynchronous by using aiofiles, aiohttp, and asyncio, suitable for Discord bots.
  • Provides direct icon URLs.
  • Supports Python 3.11+.
  • Supports all game languages.
  • Supports both Genshin Impact and Honkai Star Rail.
  • Supports persistent caching using SQLite.
  • Supports Pydantic V2, this also means full autocomplete support.

Installation

# poetry
poetry add hakushin-py

# pip
pip install hakushin-py

Quick Example

import hakushin
import asyncio

async def main() -> None:
    async with hakushin.HakushinAPI(hakushin.Language.EN) as client:
        await client.fetch_new(hakushin.Game.GI)

asyncio.run(main())

Getting Started

Read the wiki to learn more about on how to use this wrapper.

Questions, Issues, Contributions

For questions, you can contact me on Discord or open an issue.
To report issues with this wrapper, open an issue.
To contribute, fork this repo and submit a pull request.