EnkaNetwork.py/example/stats.py
xSTACIA fc4c09ae0b renamed __pydantic_self__ to self
remove PyPEP8 E501
example `asyncio.loop` to `asyncio.run`

examples: pass all
2022-08-17 11:54:16 +07:00

18 lines
539 B
Python

import asyncio
from enkanetwork import EnkaNetworkAPI
from enkanetwork.model.stats import Stats
client = EnkaNetworkAPI(lang="th")
async def main():
async with client:
data = await client.fetch_user(843715177)
for character in data.characters:
print(f"=== Stats of {character.name} ===")
for stat in character.stats:
print(f"- {stat[0]}: {stat[1].to_rounded() if isinstance(stat[1], Stats) else stat[1].to_percentage_symbol()}")
print("="*18)
asyncio.run(main())