fix(General): add type conversion for in coming request
This commit is contained in:
@@ -183,6 +183,13 @@ async def call_cleverthis_api(
|
|||||||
# _required_args = getattr(api_method, '__annotations__', {})
|
# _required_args = getattr(api_method, '__annotations__', {})
|
||||||
for arg in _required_args:
|
for arg in _required_args:
|
||||||
if arg.name in args:
|
if arg.name in args:
|
||||||
|
# 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]
|
_verified_args[arg.name] = args[arg.name]
|
||||||
else:
|
else:
|
||||||
logging.info(f"{api_method.__name__}: Missing required argument: {arg.name}")
|
logging.info(f"{api_method.__name__}: Missing required argument: {arg.name}")
|
||||||
|
|||||||
Reference in New Issue
Block a user