Skip to main content

A simple and convenient model for Mihoyo API which is complemented by other resources

Project description

HonkaiRail

A simple and convenient model for Mihoyo API which is complemented by other resources

Install:

pip install honkairail

Uses:

from honkairail import starrailapi
import asyncio

#The sample code below matches version 1 (v = 1), but you can set it to 1 or 2. The second version is newer and contains a bit more data.
async def main(uid,lang):
    r = starrailapi.StarRailApi(lang, v = 2)
    data = await r.get_full_data(uid)
    print(data)

asyncio.run(main(700649319,"en"))

Usage example:

from honkairail import starrailapi
import asyncio


async def main(uid,lang):
    r = starrailapi.StarRailApi(lang)
    data = await r.get_full_data(uid)
    print("====Player====")
    print(f"Name: {data.player.name}")
    print(f"UID: {data.player.uid}")
    print(f"Level: {data.player.level}")
    print(f"World Level: {data.player.worldlevel}")
    
    print(f"Friends: {data.player.friends}")

    print(f"Pass Area Progress: {data.player.pass_area_progress}")
    print(f"Achievement: {data.player.achievement}")

    print(f"Characters: {data.player.characters}")
    print(f"Light Cone: {data.player.light_cone}")

    print(f"Icon: {data.player.icon}")
    print(f"Signature: {data.player.signature}")
    print('\n\n')
    print("====Characters====")
    for character in data.characters:
        print(f"Name: {character.name} | {character.id}")
        print(f"Rarity: {'★'*character.rarity}")
        print(f"LVL: {character.level}")
        print(f"===={character.rank_text}====")
        for rank in character.rank_icons:
            print(f"Icon: {rank.icon}\nUnlock: {rank.unlock}")
        print("====Skill====")
        for skill in character.skill:
            print(f"Icon: {skill.icon}\nLVL:{skill.level}")
        print("=============")
        if not character.light_cone is None:
            print(f"Light Cone: {character.light_cone.name}")
            print(f"Rarity: {'★'*character.light_cone.rarity}")
            print(f"LVL: {character.light_cone.level} | R{character.light_cone.rank}")
            print(f"Icon: {character.light_cone.icon}")
            print(f"Portrait: {character.light_cone.portrait}")
            light_cone = await r.get_light_cone_info(character.light_cone)
            print(f"ATK: {light_cone.atk} | HP: {light_cone.hp} | DEF: {light_cone.defense}")
            print(f"Path: {light_cone.patch.name}\nImage: {light_cone.patch.url}")
        print("====Stats====")
        for property in character.property:
            if property.addition is None:
                print(f"{property.name}: {property.base}\nIcon: {property.icon}")
            else:
                print(f"{property.name}: {property.base} ({property.addition})\n==Icon: {property.icon}")
        print('\n\n')
        print("====Relic====")
        for i in character.relic:
            print(f"{character.relic[i].name}: {character.relic[i].level} lvl | {'★'*character.relic[i].rarity}")
            print(f"{character.relic[i].main_property.name}: {character.relic[i].main_property.value}")
            for sub_property in character.relic[i].sub_property:
                print(f"=={sub_property.name}: {sub_property.value}\n====Icon: {sub_property.icon}")
            print('\n')
        print("\n\n")

asyncio.run(main(700649319, "en"))

Languages Supported

Languege Code Languege Code Languege Code
English en русский ru Chinese chs
Tiếng Việt vi ไทย th Taiwan cn
português pt 한국어 kr deutsch de
日本語 jp 中文 zh español es
中文 zh Indonesian id français fr
Український ua

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

honkairail-1.1.4.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

honkairail-1.1.4-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file honkairail-1.1.4.tar.gz.

File metadata

  • Download URL: honkairail-1.1.4.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Windows/10

File hashes

Hashes for honkairail-1.1.4.tar.gz
Algorithm Hash digest
SHA256 348f5ba04884e1c6daccc37d71a8122c66539c700278ad28036e11a88fe91882
MD5 c6e3cb020748ba95fd5b493da6cb3ca0
BLAKE2b-256 255f6fb061bafd284c80228d64f9ed26378057a3356f062b0a0503c17e03d623

See more details on using hashes here.

File details

Details for the file honkairail-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: honkairail-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Windows/10

File hashes

Hashes for honkairail-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 84b170cebd88e926bb8673b5f0bb3575f4bb7febb158a2369e74c8c3c451b551
MD5 2a4f40cf308a6a19f3b2e945f8569fba
BLAKE2b-256 a7a1d8433fe867a8ba209c0bf68be5f3cf41a162a59ae6c8436760fc90d02926

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page