本文整理汇总了Python中webapp2.Request.app方法的典型用法代码示例。如果您正苦于以下问题:Python Request.app方法的具体用法?Python Request.app怎么用?Python Request.app使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webapp2.Request
的用法示例。
在下文中一共展示了Request.app方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: request_handler_wrapper
# 需要导入模块: from webapp2 import Request [as 别名]
# 或者: from webapp2.Request import app [as 别名]
def request_handler_wrapper(request, *args, **kwargs):
from webapp2 import Request, Response, WSGIApplication
from django.http import HttpResponse
class Route:
handler_method = request.method.lower()
req = Request(request.environ)
req.route = Route()
req.route_args = args
req.route_kwargs = kwargs
req.app = WSGIApplication()
response = Response()
view_func = request_handler(req, response)
view_func.dispatch()
django_response = HttpResponse(response.body, status=int(str(response.status).split(" ")[0]))
for header, value in response.headers.iteritems():
django_response[header] = value
return django_response