Skip to content

Getting Started

Installation

pip install hakushin-py

Usage

Every API call goes through the HakushinAPI class. You can see more details in the API Reference.

import hakushin

async with hakushin.HakushinAPI(hakushin.Game.GI) as api: 
    characters = await api.fetch_characters()
    print(characters)

Overall, it's pretty straightforward. You can find all the available methods in the API Reference.

Tips

Starting and Closing the Client Properly

Remember to call start() and close() or use async with to ensure proper connection management.

import hakushin

async with hakushin.HakushinAPI() as api:
    ...

# OR
api = hakushin.HakushinAPI()
await api.start()
...
await api.close()

Finding Model Attributes

Refer to the Models section for a list of all available models and their attributes.

Catching Errors

Refer to the Errors section for a list of all available exceptions, catch them with try/except blocks.

import hakushin

async with hakushin.HakushinAPI(hakushin.Game.GI) as api:
    try:
        await api.fetch_character(0)
    except hakushin.errors.NotFoundError:
        print("Character does not exist.")