Archived
1
0
Fork 0

Update __init__.py

This commit is contained in:
多羅狼 2023-04-18 14:16:01 +08:00 committed by GitHub
parent ce81833a48
commit 5b3d738d8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,22 +13,22 @@ api_key = 'd31697e581d5c35b038c625c'
async def _(msg: Bot.MessageSession):
base_currency = msg.parsed_msg['<base>'].upper()
target_currency = msg.parsed_msg['<target>'].upper()
"""
url = f'https://v6.exchangerate-api.com/v6/{api_key}/codes'
response = requests.get(url)
if response.status_code == 200:
data = response.json()
supported_currencies = data['supported_codes']
if base_currency not in supported_currencies or target_currency not in supported_currencies:
unsupported_currencies = []
if base_currency not in supported_currencies:
unsupported_currencies.append(base_currency)
if target_currency not in supported_currencies:
unsupported_currencies.append(target_currency)
await msg.finish(f"发生错误:无效的货币单位:{' '.join(unsupported_currencies)}")
else:
raise NoReportException(f"{response.text}")
"""
# url = f'https://v6.exchangerate-api.com/v6/{api_key}/codes'
# response = requests.get(url)
# if response.status_code == 200:
# data = response.json()
# supported_currencies = data['supported_codes']
# if base_currency not in supported_currencies or target_currency not in supported_currencies:
# unsupported_currencies = []
# if base_currency not in supported_currencies:
# unsupported_currencies.append(base_currency)
# if target_currency not in supported_currencies:
# unsupported_currencies.append(target_currency)
# await msg.finish(f"发生错误:无效的货币单位:{' '.join(unsupported_currencies)}")
# else:
# raise NoReportException(f"{response.text}")
amount = None
while amount is None:
try: