Skip to content

Commit

Permalink
Update update_exchange_rate.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CookSleep authored Aug 4, 2024
1 parent 06a12a9 commit 8458226
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion update_exchange_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ def fetch_exchange_rate(api_key):
response = requests.get(url)
data = response.json()
if 'Realtime Currency Exchange Rate' in data:
return data['Realtime Currency Exchange Rate']
return {
"exchangeRate": data['Realtime Currency Exchange Rate']['5. Exchange Rate'],
"lastRefreshed": data['Realtime Currency Exchange Rate']['6. Last Refreshed']
}
else:
raise Exception("Error fetching exchange rate")

Expand Down

0 comments on commit 8458226

Please sign in to comment.