Skip to main content

Enka.py

Downloads Downloads

Friendly API for fetching genshin user data from https://enka.shinshin.moe/ (Now https://enka.network)

Added name parsing and full artifact support and more elegant code.

original from https://github.com/mrwan200/EnkaNetwork.py, but better!

Documentation

see http://enkapy.rtfd.io/

Installation

pip install enka.py

Usage

import asyncio

from enkapy import Enka

client = Enka()


async def main():
    await client.load_lang()
    user = await client.fetch_user(104267816)
    print(f"Nickname: {user.player.nickname}")
    print(f"Level: {user.player.level}")
    print(f'Signature: {user.player.signature}')
    print(f'World level:{user.player.worldLevel}')
    print(f'Abyss: {user.player.towerFloorIndex}-{user.player.towerLevelIndex}')
    # fetch first character
    character = user.characters[0]
    print(f'Name: {character.name}')
    print(f'Ascension: {character.ascension}')
    print(f'Level: {character.level}')
    print(f'Exp: {character.experience}')
    print('Weapon:')
    weapon = character.weapon
    print(f'\tName: {weapon.name}')
    print(f'\tLevel: {weapon.level}')
    print(f'\tRefine: {weapon.refine}')
    print(f'\tStar level: {weapon.rank}')

    print('Constellations:')
    for constellation in character.constellations:
        if constellation.activated:
            print(f'\t{constellation.name} Activated')
    print('Skills:')
    for skill in character.skills:
        if skill.type == 0:
            print(f'\tNormal skill {skill.name}, level:{skill.level}')
        elif skill.type == 1:
            print(f'\tElemental skill {skill.name}, level:{skill.level}')
        elif skill.type == 2:
            print(f'\tElemental burst {skill.name}, level:{skill.level}')
    print('Artifacts:')
    for artifact in character.artifacts:
        print(f'\t{artifact.set_name} {artifact.name}:')
        print(f'\t{artifact.main_stat.prop}:{artifact.main_stat.value}')
        for sub_stats in artifact.sub_stats:
            print(f'\t\t{sub_stats.prop}:{sub_stats.value}')


loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Result:

Nickname: 天天向上
Level: 60
Signature: 凌人有点无脑
World level:8
Abyss: 12-3
Name: Kamisato Ayaka
Ascension: 6
Level: 90
Exp: 0
Weapon:
    Name: Mistsplitter Reforged
    Level: 90
    Refine: 5
    Star level: 5
Constellations:
    Snowswept Sakura Activated
    Blizzard Blade Seki no To Activated
    Frostbloom Kamifubuki Activated
    Ebb and Flow Activated
    Blossom Cloud Irutsuki Activated
    Dance of Suigetsu Activated
Skills:
    Elemental burst Kamisato Art: Soumetsu, level:10
    Normal skill Normal Attack: Kamisato Art - Kabuki, level:10
    Elemental skill Kamisato Art: Hyouka, level:9
    Normal skill Kamisato Art: Senho, level:1
Artifacts:
    Blizzard Strayer Snowswept Memory:
    FIGHT_PROP_HP:4780.0
        FIGHT_PROP_ELEMENT_MASTERY:44.0
        FIGHT_PROP_CRITICAL_HURT:38.1
        FIGHT_PROP_DEFENSE:16.0
        FIGHT_PROP_CRITICAL:3.9
    Blizzard Strayer Icebreaker's Resolve:
    FIGHT_PROP_ATTACK:311.0
        FIGHT_PROP_CRITICAL:3.1
        FIGHT_PROP_ELEMENT_MASTERY:35.0
        FIGHT_PROP_CHARGE_EFFICIENCY:10.4
        FIGHT_PROP_CRITICAL_HURT:21.8
    Blizzard Strayer Frozen Homeland's Demise:
    FIGHT_PROP_ATTACK_PERCENT:46.6
        FIGHT_PROP_HP_PERCENT:8.7
        FIGHT_PROP_ATTACK:18.0
        FIGHT_PROP_CRITICAL_HURT:13.2
        FIGHT_PROP_CRITICAL:10.5
    Archaic Petra Goblet of Chiseled Crag:
    FIGHT_PROP_ICE_ADD_HURT:46.6
        FIGHT_PROP_ELEMENT_MASTERY:16.0
        FIGHT_PROP_CRITICAL_HURT:25.7
        FIGHT_PROP_HP_PERCENT:10.5
        FIGHT_PROP_CRITICAL:5.4
    Blizzard Strayer Broken Rime's Echo:
    FIGHT_PROP_CRITICAL_HURT:62.2
        FIGHT_PROP_CRITICAL:11.7
        FIGHT_PROP_ATTACK_PERCENT:9.3
        FIGHT_PROP_ELEMENT_MASTERY:42.0
        FIGHT_PROP_DEFENSE:35.0

If you want full docs for the API, visit EnkaNetwork API

LICENSE

MIT License

Metadata

Release files for enka.py 1.2.2

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

Source distribution (sdist)

Source distribution for enka.py 1.2.2
File Size Uploaded
enka.py-1.2.2.tar.gz 11.5 kB Details

Release files / enka.py-1.2.2.tar.gz

Download URL enka.py-1.2.2.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
37a20f5d83c4208ad14c7e2dc8a7841a38fc4c9558bd0d81978a368f5dd2c763
BLAKE2b-256 checksum
How to use checksums
3ee177ebb0cb090d9f726c6ca9f381f5a4e190173599dcbfe7e6d84a1245f8cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

1.2.2 This release

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.9

1 release file

1.1.8

1 release file

1.1.7

1 release file

1.1.6

1 release file

1.1.5

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.12

1 release file

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

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