mirror of
https://github.com/PaiGramTeam/EnkaNetwork.py.git
synced 2024-11-16 11:52:18 +00:00
3ec03d9b06
- add http client - update example - add aenter, aexit for auto close client
20 lines
479 B
Python
20 lines
479 B
Python
import asyncio
|
|
|
|
from enkanetwork import EnkaNetworkAPI, Cache
|
|
|
|
class CustomCache(Cache):
|
|
def __init__(self):
|
|
super().__init__(1024, 60 * 3)
|
|
self.cache = {}
|
|
|
|
client = EnkaNetworkAPI(lang="th", cache=True)
|
|
client.set_cache(CustomCache())
|
|
|
|
async def main():
|
|
async with client:
|
|
await client.fetch_user(843715177)
|
|
await asyncio.sleep(2)
|
|
await client.fetch_user(843715177)
|
|
|
|
loop = asyncio.get_event_loop()
|
|
loop.run_until_complete(main()) |