Skip to content

Commit

Permalink
fix: change currency exchange API to api.frankfurter.app
Browse files Browse the repository at this point in the history
(cherry picked from commit 76919c4)
  • Loading branch information
dsnetprofitxl authored and mergify[bot] committed Oct 5, 2023
1 parent b0708d2 commit 1da808a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions erpnext/setup/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,12 @@ def get_exchange_rate(from_currency, to_currency, transaction_date=None, args=No
if not value:
import requests

api_url = "https://api.exchangerate.host/convert"
response = requests.get(
api_url, params={"date": transaction_date, "from": from_currency, "to": to_currency}
)
api_url = f"https://api.frankfurter.app/{transaction_date}"
response = requests.get(api_url, params={"from": from_currency, "to": to_currency})

# expire in 6 hours
response.raise_for_status()
value = response.json()["result"]
value = response.json()["rates"][to_currency]
cache.setex(name=key, time=21600, value=flt(value))
return flt(value)
except Exception:
Expand Down

0 comments on commit 1da808a

Please sign in to comment.