docs: add examples and update README.md

This commit is contained in:
KT
2023-06-03 11:14:58 +08:00
parent 2894966b6c
commit 8dcd3b62be
5 changed files with 122 additions and 4 deletions

19
examples/merge_data.py Normal file
View File

@@ -0,0 +1,19 @@
import asyncio
from mihomo import Language, MihomoAPI, tools
async def main():
client = MihomoAPI(language=Language.EN)
old_data = await client.fetch_user(800333171)
# Change characters in game and wait for the API to refresh
# ...
new_data = await client.fetch_user(800333171)
data = tools.merge_character_data(new_data, old_data)
print(data)
asyncio.run(main())