I have a common function which needs to be evaluated before executing all the KPIs. So I wrote a prepare function but prepare function is calling for all the KPIs separately. Instead I want a prepare function to be executed once for the each endpoint. My endpoint is like this
project-test:
pattern: /$YAMLURL/test
handler: FormHandler
kwargs:
auth: &AUTH
login_url: /$YAMLURL/login
kpi1:
prepare: validations.validate_request(args, handler)
url: $CONNECTION_STRING
queryfunction: queries.query1(args)
kpi2:
prepare: validations.validate_request(args, handler)
url: $CONNECTION_STRING
queryfunction: queries.query2(args)
modify: project.refactor(data, handler)
I tried to giving prepare function in the kwargs but getting
AttributeError: 'str' object has no attribute 'get'