Skip to content

Commit

Permalink
📝 docs: update example
Browse files Browse the repository at this point in the history
  • Loading branch information
SerinaNya committed Apr 27, 2024
1 parent 0825148 commit 584d243
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ _A simple Python lib to get player info and texture from Mojang and Yggdrasil AP
</p>


## Attention
## ⚠️ Attention

This package can be used with **Python 3.10+ ONLY**.
This package can be used with **Python 3.10+**.

## Usage

Expand All @@ -34,4 +34,13 @@ from yggdrasil_mc.client import YggdrasilMC

ygg = YggdrasilMC()
await ygg.by_name_async("SerinaNya")

# return PlayerProfile
PlayerProfile(
id='8705a5560b7447e8ba869169c31fb5ef',
name='SerinaNya',
skin=PlayerSkin(
url=Url('http://textures.minecraft.net/texture/7781fa8ed3e2aa907944ec0f1ec391ad05955eb9c6424d911d409b00a69ea516'),
metadata=PlayerSkin_MetaData(model='slim')),
cape=None)
```
37 changes: 37 additions & 0 deletions examples/example1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import asyncio
from yggdrasil_mc.client import YggdrasilMC

littleskin_api = "https://littleskin.cn/api/yggdrasil/"


async def example_name_3rd():
ygg = YggdrasilMC(littleskin_api)
return await ygg.by_name_async("SerinaNya")


async def example_uuid_3rd():
ygg = YggdrasilMC(littleskin_api)
return await ygg.by_uuid_async("a6abd9a95e4b4fe18f60777d1ab94ebb")


async def example_name_official():
ygg = YggdrasilMC()
return await ygg.by_name_async("SerinaNya")


async def example_uuid_official():
ygg = YggdrasilMC()
return await ygg.by_uuid_async("8705a5560b7447e8ba869169c31fb5ef")


async def main():
for func in [
example_name_3rd,
example_uuid_3rd,
example_name_official,
example_uuid_official,
]:
print(repr(await func()))


asyncio.run(main())

0 comments on commit 584d243

Please sign in to comment.