ep
enkanetwork.py
pypi i enkanetwork.py
ep

enkanetwork.py

Library for fetching JSON data from site https://enka.network/ with Python

by M-307

1.2.9 (see all)
pypi i enkanetwork.py
Readme

Enka Network Python

EN | TH

Library for API wrapper data from site https://enka.network/

🏓 Table of content

Installation

pip install enkanetwork.py

Usage

import asyncio

from enkanetwork import EnkaNetworkAPI

client = EnkaNetworkAPI()

async def main():
    data = await client.fetch_user(843715177)
    print("=== Player Info ===")
    print(f"Nickname: {data.player.nickname}")
    print(f"Level: {data.player.level}")
    print(f"Icon: {data.player.icon.url}")
    print(f"Signature: {data.player.signature}")
    print(f"Achievement: {data.player.achievement}")
    print(f"Abyss floor: {data.player.abyss_floor} - {data.player.abyss_room}")
    print(f"Cache timeout: {data.ttl}")

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

Preview

=== Player Info ===
Nickname: mrwan2546
Level: 55
Icon: https://enka.network/ui/UI_AvatarIcon_Kazuha.png
Signature: K A Z U H A M U C H <3
Achievement: 396
Abyss floor: 8 - 3
Cache timeout: 300

Example

Please see in example folder.

Class Methods

NameDescription
fetch_user(uid)Fetch user data
set_language(lang)Set new language
Please see Languages Supported
update_assets()Update new assets from repo Enkanetwork.py Data

Structure

Player

WrapperAPINotes
nicknamenicknamePlease see Namecard
signaturesignature
world_levelworldLevel
achievementfinishAchievementNum
namecardnamecardId
namecardsshowNameCardIdList -> idPlease see Namecard
abyss_floortowerFloorIndex
abyss_roomtowerLevelIndex
characters_previewshowAvatarInfoListPlease see Character Preview
icon.urlprofilePicture.avatarID

Namecard

WrapperAPINotes
id-Namecard ID
name-Namecard name
icon-Namecard icon (url)
banner-Namecard banner (url)
navbar-Namecard navbar (Alpha) (url)

Character preview

WrapperAPINotes
id-Avatar ID
name-Avatar Name
level-Avatar Level
icon-Avatar Icon (url)

Characters

WrapperAPINotes
idavatarId
name-Avatar Name
element-Please see Element Type
image-Please see Icon
xppropMap -> 1001
ascensionpropMap -> 1002
levelpropMap -> 4001
max_level-Avatar max level (Like 50/60)
friendship_levelfetterInfo.level
equipmentsequipListPlease see Equipments
statsfightPropMapPlease see FIGHT_PROP Data
constellationstalentIdListPlease see Constellation
skill_datainherentProudSkillList
skill_idskillDepotId
skills-Please see Skill

Icon

WrapperAPINotes
icon-Avatar icon (url)
side-Avatar side icon (url)
banner-Avatar wish banner (url)

Constellation

WrapperAPINotes
id-Constellation ID
name-Constellation Name
icon-Constellation Icon (url)
unlocked-Constellation has unlocked

Skill

WrapperAPINotes
id-Skill ID
name-Skill Name
icon-Skill Icon (url)
level-Skill Level

Equipments (Artifact, Weapon)

WrapperAPINotes
iditemId
levelreliquary -> level, weapon -> level
type-Type of equipment (Artifact or Weapon)
refinementweapon -> affixMap
ascensionweapon -> promoteLevel
detailflatPlease see Equipments Info

Equipments Info

WrapperAPINotes
name-Equipment Name (Artifact name or Weapon name)
iconicon
artifact_type-Please see Artifact Type
rarityrankLevel
mainstatsreliquaryMainstat, weaponStats -> 0Please see Equipments Stats
substatsreliquarySubstats, weaponStats -> 1Please see Equipments Stats

Equipments Stats

WrapperAPINotes
prop_idprop_id
type-Value type (NUMBER or PERCENT)
name-Name of FIGHT_PROP
valuevalue

FIGHT_PROP Data

In FIGHT_PROP data. You can get the value from 4 ways. | Choice | Example | Output | |------------------|---------------------------|----------------------------| | Get raw value | stats.FIGHT_PROP_HP.value | 15552.306640625 | | Get rounded value| stats.FIGHT_PROP_ATTACK.to_rounded() | 344 | | Get percentage | stats.FIGHT_PROP_FIRE_ADD_HURT.to_percentage() | 61.5 | | Get percentage and symbol | stats.FIGHT_PROP_FIRE_ADD_HURT.to_percentage_symbol() | 61.5% |

Artifact Type

KeyValue
FlowerEQUIP_BRACER
FeatherEQUIP_NECKLACE
SandsEQUIP_SHOES
GobletEQUIP_RING
CircletEQUIP_DRESS

Element Type

KeyValue
CryoIce
HydroWater
AnemoWind
PyroFire
GeoRock
ElectroElectric

Assets

Assets character, constellations, skills, namecards

You can use avatarId to get the character, constellations, skills, namecards from assets.

import asyncio

from enkanetwork import Assets

assets = Assets()

async def main():
    # Character
    assets.character(10000046)
    # Constellations
    assets.constellations(2081199193)
    # Skills
    assets.constellations(10462)
    # Namecards
    assets.namecards(210059)
    
loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Assets NameTextMapHash

The NameTextMapHash is a hash map that contains the name text of the assets. You can get NameTextMapHash from hash_id like this:

import asyncio

from enkanetwork import Assets

assets = Assets(lang="en") # Set languege before get name (Ex. English)

async def main():
    print(assets.get_hash_map(1940919994)) # Hu tao
    # OR you can get FIGHT_PROP name
    print(assets.get_hash_map("FIGHT_PROP_BASE_ATTACK")) # Base ATK
    
loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Languages Supported

LanguegeCode
Englishen
русскийru
Tiếng Việtvi
ไทยth
portuguêspt
한국어kr
日本語jp
中文zh
Indonesianid
françaisfr
españoles
deutschde
Taiwancht
Chinesechs

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

LICENSE

MIT License

Keqing

Picture by KKOMDASTRO

GitHub Stars

10

LAST COMMIT

1mo ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
1.2.9
15d ago
1.2.9.dev1
1mo ago
1.2.9.dev0
1mo ago
1.2.8
1mo ago
No alternatives found
No tutorials found
Add a tutorial