2016-05-09 14 views
1

ssl_optionsを使って簡単なトルネードhttpサーバを作成し、Telegramボットのためのウェブフックを設定しましたが、サーバは "post"リクエストを取得しませんでした。どのような問題がありますか?SSLを使ったボットapiとWebhookの電文

import tornado.httpserver 
import tornado.ioloop 
import tornado.web 

class MainHandler(tornado.web.RequestHandler): 
    def post(self): 
     print('Post request') 

    def get(self): 
     print('Get request') 
     self.write('<h1>Hello, World</h1>') 

application = tornado.web.Application([ 
    (r'/', MainHandler) 
]) 

if __name__ == '__main__': 
    http_server = tornado.httpserver.HTTPServer(application, ssl_options={ 
     'certfile': 'server.crt', 
     'keyfile': 'server.key' 
    }) 
    http_server.listen(443) 
    tornado.ioloop.IOLoop.current().start() 

答えて

2

自己署名SSL証明書を発行するときは、必ず '共通名' にするには、あなたのFQDN(hostname -f)と一致します。

例:

$ openssl req -new -x509 -nodes -newkey rsa:1024 -keyout server.key -out server.crt -days 3650

あなたがpython-telegram-btを使用している場合は、thisスクリプトを実行し、wgetのを使用して接続しようとしているSSLハンドシェイクをテストすることができます。

$ wget -O /dev/null https://$HOST:$PORT/

関連する問題