From a03c59e6c97c0619c67180be01ec8bd2fa39f4dc Mon Sep 17 00:00:00 2001 From: Hammy Date: Mon, 15 Feb 2021 09:12:15 +0000 Subject: [PATCH] Add check to make sure KeyError doesn't appear when given wrong event payload. --- bot/handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/handler.py b/bot/handler.py index d472c4f..6a8bfc8 100644 --- a/bot/handler.py +++ b/bot/handler.py @@ -14,6 +14,7 @@ def event_handler(event, context): } for key, values in event.items(): - Actions[key](values) + if key in Actions: + Actions[key](values) winston.send_random_tweet()