本文整理汇总了Python中request.Request.parse_msg方法的典型用法代码示例。如果您正苦于以下问题:Python Request.parse_msg方法的具体用法?Python Request.parse_msg怎么用?Python Request.parse_msg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类request.Request
的用法示例。
在下文中一共展示了Request.parse_msg方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_message
# 需要导入模块: from request import Request [as 别名]
# 或者: from request.Request import parse_msg [as 别名]
def process_message(self, application, message):
"""This coroutine looks at the message, determines which handler will
be used to process it, and then begins processing.
The application is responsible for handling misconfigured routes.
"""
request = Request.parse_msg(message)
if request.is_disconnect():
return # Ignore disconnect msgs. Dont have areason to do otherwise
handler = application.route_message(request)
if callable(handler):
response = handler()
application.msg_conn.reply(request, response)
示例2: process_message
# 需要导入模块: from request import Request [as 别名]
# 或者: from request.Request import parse_msg [as 别名]
def process_message(self, application, message):
"""This coroutine looks at the message, determines which handler will
be used to process it, and then begins processing.
The application is responsible for handling misconfigured routes.
"""
request = Request.parse_msg(message)
if request.is_disconnect():
return # Ignore disconnect msgs. Dont have a reason to do otherwise
handler = application.route_message(request)
result = handler()
# in case of long poll we do not want to send reply
if result is not None:
self.reply(request, result)
示例3: process_message
# 需要导入模块: from request import Request [as 别名]
# 或者: from request.Request import parse_msg [as 别名]
def process_message(self, application, message):
"""This coroutine looks at the message, determines which handler will
be used to process it, and then begins processing.
The application is responsible for handling misconfigured routes.
"""
request = Request.parse_msg(message)
if request.is_disconnect():
return # Ignore disconnect msgs. Dont have areason to do otherwise
handler = application.route_message(request)
result = handler()
http_content = http_response(result['body'], result['status_code'],
result['status_msg'], result['headers'])
application.msg_conn.reply(request, http_content)