chore: Added the multiplier directly to the api request

This commit is contained in:
Данил 2024-12-23 10:04:02 +03:00
parent 4fd2d3d182
commit 45307caee5

View file

@ -25,7 +25,7 @@ class Converter:
def convert(self) -> None: def convert(self) -> None:
if not self.kekkai(): if not self.kekkai():
self.kekkai() self.ddg()
number = Decimal(str(self.conv_amount)) number = Decimal(str(self.conv_amount))
@ -62,7 +62,8 @@ class Converter:
res = requests.get(f'{config['kekkai_instance']}/api/getRate/', { res = requests.get(f'{config['kekkai_instance']}/api/getRate/', {
'from_currency': self.from_currency, 'from_currency': self.from_currency,
'conv_currency': self.conv_currency, 'conv_currency': self.conv_currency,
'date': date 'date': date,
'conv_amount': self.conv_amount
}, timeout=3) }, timeout=3)
data = res.json() data = res.json()
@ -70,7 +71,8 @@ class Converter:
if not HTTPStatus(res.status_code).is_success: if not HTTPStatus(res.status_code).is_success:
return False return False
self.conv_amount = float(data.get('rate') * self.amount)
self.conv_amount = data.get('conv_amount')
return True return True
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError: