Util for single invokation.
Closed this issue · 1 comments
pkucmus commented
Would be nice if Smyth provided a tool to mock a singular request. Instead of running the uvicorn server, allow to invoke the handler, i.e. generate the event and context - invoke the handler and exit.
This contradicts what Smyth is about but still I'm running into debugging cases where it would be useful to just invoke the handler function.
Right now one can do:
event = {
"version": "2.0",
"rawPath": "/",
"body": "",
"isBase64Encoded": False,
"headers": {},
"queryStringParameters": {},
"requestContext": {
"http": {
"method": "GET",
"path": "/",
"protocol": "http",
"sourceIp": "127.0.0.1",
},
"routeKey": "POST /",
"accountId": "offlineContext_accountId",
"stage": "$default",
},
"routeKey": "POST /",
"rawQueryString": "",
}
if __name__ == "__main__":
print(handler(event, {}))
Instead I would like to:
python -m smyth invoke {my_handler}
pkucmus commented
This should be fulfilled in 0.5.0, with: https://mirumee.github.io/smyth/user_guide/non_http/