Skip to main content

honkai-cards

PyPI version Python License: GPL-3.0

A Python library that generates Honkai: Star Rail character showcase cards and player profile cards — optionally with DPS benchmarks.

Repository: github.com/MR-LORD-REX/honkai-cards


Features

  • Character cards — full showcase art with relics, stats, and optional DPS benchmark
  • Profile cards — player info plus showcase character roster
  • Async API — async with HSR() context manager
  • Enka-powered profiles — pulls live showcase data from your UID

Installation

pip install honkai_cards

Or from source:

git clone https://github.com/MR-LORD-REX/honkai-cards.git
cd honkai-cards
pip install -e .

Requirements: Python 3.10+, network access (Enka + build API)


Quick start

import asyncio
from honkai_cards import HSR

async def main():
    async with HSR() as hsr:
        # Profile card
        profile = await hsr.profile(800000000)
        profile.card.save("profile.png")

        # Character card (slot 0–7, with DPS benchmark)
        card = await hsr.character(800000000, slot=0, benchmark=True)
        if card:
            card.save("character.png")

asyncio.run(main())

API

HSR

Main client. Use as an async context manager.

Method Returns Description
character(uid, slot=0, benchmark=True) PIL.Image.Image | None Character showcase card for the given slot
profile(uid) Profile1 Profile card + list of showcase characters

character

Argument Type Default Description
uid int | str — In-game UID
slot int 0 Showcase slot (0–7)
benchmark bool True Include DPS benchmark on the card

profile

Argument Type Default Description
uid int | str — In-game UID

Profile1 fields:

  • card — PIL.Image.Image profile card
  • characters — list of P1Char (slot, charid)

Examples

Runnable scripts live in examples/. Replace UID with your own before running.

Character card

"""Generate a character showcase card with DPS benchmark."""

import asyncio
from honkai_cards import HSR

UID = 713987091  # replace with your in-game UID

async def main() -> None:
    async with HSR() as hsr:
        card = await hsr.character(UID, slot=0, benchmark=True)

        if card is None:
            print("No character found for this slot.")
            return

        card.save("character_card.png")
        print("Saved character_card.png")
        card.show()

if __name__ == "__main__":
    asyncio.run(main())
python examples/character_card.py

Profile card

"""Generate a player profile card and list showcase characters."""

import asyncio
from honkai_cards import HSR

UID = 713987091  # replace with your in-game UID

async def main() -> None:
    async with HSR() as hsr:
        profile = await hsr.profile(UID)

        profile.card.save("profile_card.png")
        print("Saved profile_card.png")
        print("Showcase characters:", profile.characters)

        for char in profile.characters:
            print(f"  slot {char.slot}: character id {char.charid}")

if __name__ == "__main__":
    asyncio.run(main())
python examples/profile_card.py

Full showcase

Fetches the profile card, then a character card for every showcase slot:

python examples/full_showcase.py

Project layout

honkai-cards/
├── examples/                 # Runnable demos
│   ├── character_card.py
│   ├── profile_card.py
│   └── full_showcase.py
├── src/honkai_cards/         # Library package
│   ├── client.py             # HSR public API
│   ├── api.py                # Data fetchers
│   ├── characters/           # Character card renderer
│   ├── profile/              # Profile card renderer
│   └── models/               # Pydantic models
├── pyproject.toml
└── .github/workflows/publish.yml

License

GPL-3.0 — see LICENSE.txt for details.


Credits

  • Profile data via Enka.Network
  • Benchmark data taken after running simulation made by fribbels
  • Built for the Honkai: Star Rail community

Metadata

Release files for honkai-cards 1.0.6

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

Source distribution (sdist)

Source distribution for honkai-cards 1.0.6
File Size Uploaded Provenance Actions
honkai_cards-1.0.6.tar.gz 2.7 MB Without provenance Details for honkai_cards-1.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for honkai-cards 1.0.6
File Interpreter ABI Platform Actions
honkai_cards-1.0.6-py3-none-any.whl Python 3 none any Details for honkai_cards-1.0.6-py3-none-any.whl

Total release size: 5.3 MB

Release files / honkai_cards-1.0.6.tar.gz

Download URL honkai_cards-1.0.6.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
07c272653b83b6707eeb25caa4fb6a625612953c5a4384d8d94eefa0b5afa3a0
BLAKE2b-256 checksum
How to use checksums
1ded72360160b98850219d34ba5dd553a4b4b8f14416053166b976a46c7be4c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / honkai_cards-1.0.6-py3-none-any.whl

Download URL honkai_cards-1.0.6-py3-none-any.whl
Size 2.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b4ce0ed0820e7de8bd80af67ecdf738fd1ffcf21979c8bfabe3adead086fcf8d
BLAKE2b-256 checksum
How to use checksums
7f82d8048d205e05097c2f7c4e09f354e2ff30b0b839757fff09661bd8503f74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Security for honkai-cards 1.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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