Merge pull request #1605 from SchrodingersGat/exchange-rates

Add backend for exchangerate.host
This commit is contained in:
Oliver 2021-05-23 21:35:15 +10:00 committed by GitHub
commit 2d61e6fc5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
from djmoney.contrib.exchange.backends.base import BaseExchangeBackend
from djmoney.contrib.exchange.backends.base import BaseExchangeBackend, SimpleExchangeBackend
class InvenTreeManualExchangeBackend(BaseExchangeBackend):
@ -19,3 +19,18 @@ class InvenTreeManualExchangeBackend(BaseExchangeBackend):
"""
return {}
class ExchangeRateHostBackend(SimpleExchangeBackend):
"""
Backend for https://exchangerate.host/
"""
name = "exchangerate.host"
def __init__(self):
self.url = "https://api.exchangerate.host/latest"
def get_params(self):
# No API key is required
return {}