Skip to content

Commit

Permalink
[FIX] Handle currency types on other currencies
Browse files Browse the repository at this point in the history
  • Loading branch information
yibudak committed Jul 5, 2024
1 parent c2e9b24 commit 1e5b110
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ def get_tcmb_currency_data(self, url, currencies):
for currency in currencies:
currency_data[currency] = {}
for rate_type in TCMB_RATE_TYPES:
curr_data = self.rate_retrieve(dom, currency, rate_type)
try:
curr_data = self.rate_retrieve(dom, currency, rate_type)
except TypeError: # This means that the currency type is not exist in the currency list
curr_data = {'rate_ref': 1.0, 'rate_currency': 1.0}
currency_data[currency][rate_type] = curr_data['rate_ref'] / (curr_data['rate_currency'] or 1.0)

return currency_data
Expand Down

0 comments on commit 1e5b110

Please sign in to comment.