mendrika261 commited on
Commit
55fabf3
·
verified ·
1 Parent(s): 93c972f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -20,12 +20,12 @@ def get_exchange_rate(from_currency: str, to_currency: str) -> float:
20
  float: The exchange rate from the source currency to the target currency
21
  """
22
  try:
23
- api_url = f"https://open.er-api.com/v6/latest/{to_currency}"
24
  response = requests.get(api_url)
25
 
26
  if response.status_code == 200:
27
  data = response.json()
28
- return data['rates'][from_currency]
29
  else:
30
  return f"Error: Unable to fetch exchange rate. Status code: {response.status_code}"
31
 
 
20
  float: The exchange rate from the source currency to the target currency
21
  """
22
  try:
23
+ api_url = f"https://open.er-api.com/v6/latest/{from_currency}"
24
  response = requests.get(api_url)
25
 
26
  if response.status_code == 200:
27
  data = response.json()
28
+ return data['rates'][to_currency]
29
  else:
30
  return f"Error: Unable to fetch exchange rate. Status code: {response.status_code}"
31