I have a function "get_metrics" that takes input which I want to build dynamically and pass it as parameter to function. But when call function with input I get error below. If I paste input directly in call it works.
raise TypeError( TypeError: get_metric_data() only accepts keyword arguments.
def get_metrics(metrics_input):
client = boto3.client(service_name='dms', region_name='us-east-1')
response = client.get_metric_data(metrics_input)
return response
metrics_input = This is built dunamically result = get_metrics(metrics_input)
I tried directly adding generated input in api call and it works but does not work if passing as parameter to function.
I was able to solve this using json.loads(metrics_input) before passing it to function.