fix(General): add type conversion for in coming request

This commit is contained in:
2025-04-16 17:50:37 +08:00
parent 7888f1bddb
commit 95d08686e0
+8 -1
View File
@@ -183,7 +183,14 @@ async def call_cleverthis_api(
# _required_args = getattr(api_method, '__annotations__', {})
for arg in _required_args:
if arg.name in args:
_verified_args[arg.name] = args[arg.name]
# convert to another type if arg is not a str
if arg.annotation == int:
_verified_args[arg.name] = int(args[arg.name])
elif arg.annotation == float:
_verified_args[arg.name] = float(args[arg.name])
# TODO: more?
else:
_verified_args[arg.name] = args[arg.name]
else:
logging.info(f"{api_method.__name__}: Missing required argument: {arg.name}")
logging.info(