Fix pattern

This commit is contained in:
M-307 2022-08-03 00:40:30 +07:00
parent 0cbe0d54d8
commit 886dcc8c8b
3 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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
"""