mirror of
https://github.com/PaiGramTeam/EnkaNetwork.py.git
synced 2024-09-28 03:26:09 +00:00
Fix pattern
This commit is contained in:
parent
0cbe0d54d8
commit
886dcc8c8b
@ -2,12 +2,13 @@ import json
|
||||
|
||||
from cachetools import TTLCache
|
||||
|
||||
|
||||
class Cache:
|
||||
def __init__(self, maxsize, ttl):
|
||||
self.cache = TTLCache(maxsize, ttl)
|
||||
|
||||
def get(self, key):
|
||||
return json.loads(self.cache.get(key))
|
||||
|
||||
|
||||
def set(self, key, value):
|
||||
self.cache[key] = json.dumps(value)
|
||||
self.cache[key] = json.dumps(value)
|
||||
|
@ -4,7 +4,6 @@ import json
|
||||
|
||||
from typing import Union
|
||||
|
||||
|
||||
from .model import EnkaNetworkResponse
|
||||
from .exception import VaildateUIDError, UIDNotFounded
|
||||
from .assets import Assets
|
||||
@ -61,7 +60,7 @@ class EnkaNetworkAPI:
|
||||
# Return data
|
||||
self.LOGGER.debug("Parsing data...")
|
||||
return EnkaNetworkResponse.parse_obj(data)
|
||||
|
||||
|
||||
resp = await request(url=create_path(f"u/{uid}/__data.json" + ("?key={key}" if self.__key else ""))) # noqa: E501
|
||||
|
||||
# Check if status code is not 200 (Ex. 500)
|
||||
|
@ -52,7 +52,7 @@ async def request(url: str, headers: dict = None) -> dict:
|
||||
headers = {}
|
||||
|
||||
retry = 0
|
||||
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=30)) as session:
|
||||
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=30)) as session: # noqa: E501
|
||||
"""
|
||||
From https://gist.github.com/foobarna/19c132304e140bf5031c273f6dc27ece # noqa: E501
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user