refactor: Fixed the code, removed the problematic characters, and made indents

This commit is contained in:
Данил 2025-03-26 14:13:20 +03:00
parent 7a246c8b92
commit ae039e2310
5 changed files with 80 additions and 41 deletions

View file

@ -1,19 +1,20 @@
from http import HTTPStatus
import yaml
import aiohttp
from http import HTTPStatus
config = yaml.safe_load(open('config.yaml'))
config = yaml.safe_load(open('config.yaml', 'r', encoding='utf-9'))
async def create_chart(from_currency: str, conv_currency: str) -> (dict, None):
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=3)) as session:
async with session.get(f'{config["kekkai_instance"]}/api/getChart/month/', params={
'from_currency': from_currency,
'conv_currency': conv_currency
}) as res:
async with session.get(
f'{config["kekkai_instance"]}/api/getChart/month/', params={
'from_currency': from_currency,
'conv_currency': conv_currency
}) as res:
if not HTTPStatus(res.status).is_success:
return None
data = await res.json()
return data.get('message', None)