EnkaNetwork.py/example/cache.py

16 lines
428 B
Python
Raw Normal View History

2022-08-02 17:37:24 +00:00
import asyncio
from enkanetwork import EnkaNetworkAPI
client = EnkaNetworkAPI(lang="th", cache=True)
async def main():
async with client:
data = await client.fetch_user(843715177)
print("TTL: %s" % data.ttl)
await asyncio.sleep(2)
data_catched = await client.fetch_user(843715177)
print("TTL: %s" % data_catched.ttl)
2022-08-02 17:37:24 +00:00
loop = asyncio.get_event_loop()
loop.run_until_complete(main())