Я попробовал использовать from forex_python.converter import CurrencyRates
С помощью скрипта, который выглядит следующим образом:
Код: Выделить всё
def get_exchange_rate(from_currency: str, date_ts: int, to_currency: str = "USD"):
"""
This function returns the historical exchange rate between two currencies
"""
cr = CurrencyRates()
date = datetime.datetime.fromtimestamp(date_ts)
rate = cr.get_rate(from_currency, to_currency, date)
return rate
forex_python.converter.RatesNotAvailableError: Источник курсов валют не готов
Когда я посмотрел, люди говорили, что это не ошибка, просто удаленный сервер, к которому пытается обратиться библиотека, сейчас не работает.>
Подробнее здесь: https://stackoverflow.com/questions/764 ... hange-rate
Мобильная версия