OSDN Git Service

header
authoryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 7 Sep 2018 10:14:59 +0000 (19:14 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 7 Sep 2018 10:14:59 +0000 (19:14 +0900)
bot.py

diff --git a/bot.py b/bot.py
index 16052b0..e97c029 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -58,7 +58,7 @@ class WebHookHandler(tornado.web.RequestHandler):
         header = self.request.headers
         if header.get('Content-Type','') == 'application/json':
             body = tornado.escape.json_decode(self.request.body)
-        hashid = hmac.new(header['X-Line-Signature'].encode('utf-8'),
+        hashid = hmac.new(header.get('X-Line-Signature').encode('utf-8'),
             body.encode('utf-8'), hashlib.sha256).digest()
         signature = base64.b64encode(hashid)
         handle = WebhookHandler(ch)