如何在aiohttp服务器处理程序中使用HTTP重定向返回响应?
答案 0 :(得分:4)
文档:http://aiohttp.readthedocs.io/en/stable/web_quickstart.html#redirects
async def handler(request):
raise web.HTTPFound('/redirect')
异常类及其相应的HTTP状态代码:http://aiohttp.readthedocs.io/en/stable/web_quickstart.html#exceptions
* 300 - HTTPMultipleChoices
* 301 - HTTPMovedPermanently
* 302 - HTTPFound
* 303 - HTTPSeeOther
* 304 - HTTPNotModified
* 305 - HTTPUseProxy
* 307 - HTTPTemporaryRedirect
* 308 - HTTPPermanentRedirect