2017-08-18 4 views

答えて

1

aiohttp.webは、すべてのHTTPステータスコードの例外のセットを定義します。

各例外はHTTPExceptionのサブクラスであり、単一の HTTPステータスコードに関連しています。

例外はResponseのサブクラスでもあり、同じエフェクトの要求ハンドラでは またはreturnのいずれかになります。

次のスニペットが同じである:

async def handler(request): 
    return aiohttp.web.HTTPFound('/redirect') 

と:

async def handler(request): 
    raise aiohttp.web.HTTPFound('/redirect') 

リンク:http://aiohttp.readthedocs.io/en/stable/web.html#exceptions

関連する問題