OSDN Git Service

もう一回
authoryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 7 Sep 2018 10:13:36 +0000 (19:13 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 7 Sep 2018 10:13:36 +0000 (19:13 +0900)
bot.py

diff --git a/bot.py b/bot.py
index 6772216..16052b0 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -56,7 +56,7 @@ class WebHookHandler(tornado.web.RequestHandler):
             
     def post(self):
         header = self.request.headers
-        if header['Content-Type'] == 'application/json':
+        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'),
             body.encode('utf-8'), hashlib.sha256).digest()