You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi is there a way to define a decorator with paramaters like the CORS one.
Many thanks for help and thoughts, not sure if i am just not understanding the syntax to use or its not possible,
I have two use cases.
On exception be able to define a friendly message per handler for error responses
@on_exceptiondefhandle_errors(exception,friendlyMesssage="Something went wrong"):
print(exception)
return {'statusCode': 500, 'body':friendlyMesssage}
@handle_errors(friendlyMesssage="Failed to get something")defgetSomething(event, context):
#do something
On before - i am writing a middleware to implenent RBAC (role based access control) and want o provide the list of permissions required to call the function
@beforedefrbac(event, context,permissions=[]):
print(f'required permissions {" ".join(str(x) forxinpermissions)}')
# actually do the validation@rbac(permissions=["get:dogs","put:badgers"])defgetSomething(event, context):
#do something
The text was updated successfully, but these errors were encountered:
Hi is there a way to define a decorator with paramaters like the CORS one.
Many thanks for help and thoughts, not sure if i am just not understanding the syntax to use or its not possible,
I have two use cases.
The text was updated successfully, but these errors were encountered: