Note
This module is a complete copy of the module: enkanetwork.py but with fixing problems with pydantic V2 > compatibility and updating assets.
Library for API wrapper data from site https://enka.network/
- 💾 Installation
- ✨ Usage
- 👀 Example
- 📗 Class Methods
- 📥 Response data
- 🚧 Structure
- 🔧 Assets
- 🌎 Languages Supported
- 🙋 Support & Question
- 📄 LICENSE
pip install enkanetworkv2.py
import asyncio
from enkanetwork import EnkaNetworkAPI
client = EnkaNetworkAPI()
async def main():
async with client:
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.avatar.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}")
asyncio.run(main())=== 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: 300Please refer in example folder.
| Name | Description |
|---|---|
| fetch_user(uid) | Fetch user data (UID) (Will be depercated soon) |
| fetch_user_by_uid(uid) | Fetch user data (UID) |
| fetch_user_by_username(profile_id) | Fetch user data (Profile ID) (For subscriptions in Enka.Network) |
| fetch_hoyos_by_username(profile_id) | Fetch user hoyo(s) data (Profile ID) (For subscriptions in Enka.Network) |
| fetch_builds(profile_id, metaname) | Fetch build data (Profile ID) (For subscriptions in Enka.Network) |
| set_language(lang) | Set new language Please refer Languages Supported |
| update_assets() |
Return type: EnkaNetworkResponse
| Wrapper | API | Notes |
|---|---|---|
| player | playerInfo | Please refer Player |
| characters | avatarInfoList | Please refer Characters |
| profile | - | Please refer Profile Info |
| owner | owner | Please refer Player Owner |
| ttl | ttl | |
| uid | uid |
Return type: EnkaNetworkProfileResponse
| Wrapper | API | Notes |
|---|---|---|
| username | playerInfo | Please refer Player |
| profile | profile | Please refer in Profile patreon |
| hoyos | hoyos | Please refer Profile hoyos |
| Wrapper | API | Notes |
|---|---|---|
| hash | hash | |
| username | username | Please refer Tier |
| profile | profile | Please refer in Profile patreon |
| builds | - | Please refer Build(s) info |
| Wrapper | API | Notes |
|---|---|---|
| bio | bio | |
| level | level | Please refer Tier |
| profile | worldLevel | |
| signup_state | signup_state | |
| image_url | image_url |
| Wrapper | API | Notes |
|---|---|---|
| uid_public | uid_public | |
| public | public | |
| verified | verified | |
| player_info | player_info | Please refer Profile Patreon |
| signup_state | signup_state | |
| signup_state | signup_state |
| Wrapper | API | Notes |
|---|---|---|
| id | id | |
| name | name | |
| avatar_id | avatar_id | |
| avatar_data | avatar_data | Please refer Characters |
| order | order | |
| live | live | |
| settings | settings | |
| public | public |
| Wrapper | API | Notes |
|---|---|---|
| uid | - | UID in-game |
| url | - | URL to enter Enka.Network site |
| path | - | Path URL |
| Wrapper | API | Notes |
|---|---|---|
| nickname | nickname | Please refer Namecard |
| signature | signature | |
| world_level | worldLevel | |
| achievement | finishAchievementNum | |
| namecard | namecardId | |
| namecards | showNameCardIdList -> id | Please refer Namecard |
| abyss_floor | towerFloorIndex | |
| abyss_room | towerLevelIndex | |
| characters_preview | showAvatarInfoList | Please refer Character Preview |
| avatar | profilePicture | Please refer Avatar Icon |
| Wrapper | API | Notes |
|---|---|---|
| id | avatarId | |
| icon | Please refer Icon Data |
| Wrapper | API | Notes |
|---|---|---|
| id | - | Namecard ID |
| name | - | Namecard name |
| icon | - | Namecard icon, Please refer Icon Data |
| banner | - | Namecard banner, Please refer Icon Data |
| navbar | - | Namecard navbar (Alpha), Please refer Icon Data |
| Wrapper | API | Notes |
|---|---|---|
| id | - | Avatar ID |
| name | - | Avatar Name |
| level | - | Avatar Level |
| icon | - | Avatar Icon, Please refer Icon Data |
| Wrapper | API | Notes |
|---|---|---|
| id | avatarId | |
| name | - | Avatar Name |
| element | - | Please refer Element Type |
| rarity | - | Rarity |
| image | - | Please refer Icon |
| xp | propMap -> 1001 | |
| ascension | propMap -> 1002 | |
| level | propMap -> 4001 | |
| max_level | - | Avatar max level (Like 50/60) |
| friendship_level | fetterInfo.level | |
| equipments | equipList | Please refer Equipments |
| stats | fightPropMap | Please refer FIGHT_PROP Data |
| constellations | talentIdList | Please refer Constellation |
| constellations_unlocked | - | Constellation unlocked |
| skill_data | inherentProudSkillList | |
| skill_id | skillDepotId | |
| skills | - | Please refer Skill |
| Wrapper | API | Notes |
|---|---|---|
| icon | - | Avatar icon, Please refer Icon Data |
| side | - | Avatar side icon, Please refer Icon Data |
| banner | - | Avatar wish banner, Please refer Icon Data |
| Wrapper | API | Notes |
|---|---|---|
| id | - | Constellation ID |
| name | - | Constellation Name |
| icon | - | Constellation Icon (URL) |
| unlocked | - | Constellation has unlocked |
| Wrapper | API | Notes |
|---|---|---|
| id | - | Skill ID |
| name | - | Skill Name |
| icon | - | Skill Icon (URL) |
| level | - | Skill Level |
| is_boosted | - | Skill level has boosted |
| Wrapper | API | Notes |
|---|---|---|
| id | itemId | |
| level | reliquary -> level, weapon -> level | |
| type | - | Type of equipment (Artifact or Weapon) |
| refinement | weapon -> affixMap | |
| ascension | weapon -> promoteLevel | |
| detail | flat | Please refer Equipments Info |
| Wrapper | API | Notes |
|---|---|---|
| name | - | Equipment Name (Artifact name or Weapon name) |
| icon | icon | Please refer Icon Data |
| artifact_type | - | Please refer Artifact Type |
| rarity | rankLevel | |
| mainstats | reliquaryMainstat, weaponStats -> 0 | Please refer Equipments Stats |
| substats | reliquarySubstats, weaponStats -> 1 | Please refer Equipments Stats |
| Wrapper | API | Notes |
|---|---|---|
| prop_id | prop_id | |
| type | - | Value type (NUMBER or PERCENT) |
| name | - | Name of FIGHT_PROP |
| value | value |
In FIGHT_PROP data. You can get the value from 4 methods.
| 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% |
In this Builds It's not pretty data. You can use this method to get data. Or if you want get full, You can use raw argument
| Choice | Example | Output |
|---|---|---|
| Get avatar ID list | builds.get_avatar_list() | [10000021,10000037,10000025, ...] |
| Get character build | builds.get_character(10000021) | List of Build info |
| Get build info by avatar id | builds.get_character(10000021, 11111111) | Build info |
In icon data. You can get the value from 2 methods.
| Choice | Example | Output |
|---|---|---|
| Get filename | icon.filename | UI_AvatarIcon_Kazuha_Card.png |
| Get URL | icon.url | https://enka.network/ui/UI_AvatarIcon_Kazuha_Card.png |
| Key | Value |
|---|---|
| Flower | EQUIP_BRACER |
| Feather | EQUIP_NECKLACE |
| Sands | EQUIP_SHOES |
| Goblet | EQUIP_RING |
| Circlet | EQUIP_DRESS |
| Key | Value |
|---|---|
| Cryo | Ice |
| Hydro | Water |
| Anemo | Wind |
| Pyro | Fire |
| Geo | Rock |
| Electro | Electric |
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())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())| Languege | Code |
|---|---|
| English | en |
| русский | ru |
| Tiếng Việt | vi |
| ไทย | th |
| português | pt |
| 한국어 | kr |
| 日本語 | jp |
| 中文 | zh |
| Indonesian | id |
| français | fr |
| español | es |
| deutsch | de |
| Taiwan | cht |
| Chinese | chs |
If you want full docs for the API, visit EnkaNetwork API Docs