Update README.md

- Update usage
- Add Thai README.md
This commit is contained in:
M-307 2022-07-05 13:35:54 +07:00
parent 954fa0d629
commit d8a87dac1d
2 changed files with 75 additions and 4 deletions

View File

@ -1,12 +1,14 @@
# Enka Network Python
EN | [TH](./README_TH.md)
Library for fetching JSON data from site https://enka.shinshin.moe/
# Installation
# 💾 Installation
```
pip install enkanetwork.py
```
# Usage
# Usage
```py
import asyncio
@ -16,20 +18,34 @@ 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.profile_picture.icon}")
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())
```
```sh
=== Player Info ===
Nickname: mrwan2546
Level: 55
Cache timeout: 236
Icon: https://enka.shinshin.moe/ui/UI_AvatarIcon_Hutao.png
Signature: ?
Achievement: 395
Abyss floor: 8 - 3
Cache timeout: 300
```
If you want full docs for the API, visit [EnkaNetwork API](https://github.com/EnkaNetwork/API-docs)
If you want full docs for the API, visit [EnkaNetwork API Docs](https://github.com/EnkaNetwork/API-docs)
## Example
Please see in [example](./example/) folder.
# LICENSE
[MIT License](./LICENSE)

55
README_TH.md Normal file
View File

@ -0,0 +1,55 @@
# Enka Network Python
[EN](./README.md) | TH
ไลบารีสำหรับดึงข้อมูล JSON จากเว็บ https://enka.shinshin.moe
# 💾 วิธีการติดตั้ง
```
pip install enkanetwork.py
```
# ✨ วิธีใช้
```py
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.profile_picture.icon}")
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())
```
```sh
=== Player Info ===
Nickname: mrwan2546
Level: 55
Icon: https://enka.shinshin.moe/ui/UI_AvatarIcon_Hutao.png
Signature: ?
Achievement: 395
Abyss floor: 8 - 3
Cache timeout: 300
```
หากต้องการดูข้อมูล API เพิ่มเติม ไปดูที่ [EnkaNetwork API Docs](https://github.com/EnkaNetwork/API-docs)
## ตัวอย่างการใช้งาน
ดูได้ที่โฟเดอร์ [example](./example/)
# LICENSE
[MIT License](./LICENSE)
![น้อง Keqing น่ารัก 💗](https://c.tenor.com/MnkpnVCLcb0AAAAC/keqing-dance.gif)
[รูปจาก KKOMDASTRO](https://twitter.com/KKOMDASTRO)