This repository has been archived on 2025-07-07. You can view files and clone it, but cannot push or open issues or pull requests.
Files
eternos/parser/currency.py

18 lines
465 B
Python

import requests
url = "https://www.cbr-xml-daily.ru/daily_json.js"
class Currency:
def __init__(self, code: str):
self.name = code
self.status = True
response = requests.get(url)
response.raise_for_status()
try:
data = response.json()
self.rate = data["Valute"][code]["Value"]
self.nominal = data["Valute"][code]["Nominal"]
except Exception:
self.status = False