diff --git a/enkanetwork/cache.py b/enkanetwork/cache.py index 73d2f7c..34a513f 100644 --- a/enkanetwork/cache.py +++ b/enkanetwork/cache.py @@ -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) \ No newline at end of file + self.cache[key] = json.dumps(value) diff --git a/enkanetwork/client.py b/enkanetwork/client.py index 3c18d9f..016038d 100644 --- a/enkanetwork/client.py +++ b/enkanetwork/client.py @@ -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) diff --git a/enkanetwork/utils.py b/enkanetwork/utils.py index 199809c..af5439a 100644 --- a/enkanetwork/utils.py +++ b/enkanetwork/utils.py @@ -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 """