webhook_cherrypy_echo_bot.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:PythonTelegram 作者: YongJang 项目源码 文件源码
def index(self):
        if 'content-length' in cherrypy.request.headers and \
           'content-type' in cherrypy.request.headers and \
           cherrypy.request.headers['content-type'] == 'application/json':
            length = int(cherrypy.request.headers['content-length'])
            json_string = cherrypy.request.body.read(length).decode("utf-8")
            update = telebot.types.Update.de_json(json_string)
            bot.process_new_messages([update.message])
            return ''
        else:
            raise cherrypy.HTTPError(403)


# Handle '/start' and '/help'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号