Created
January 6, 2022 19:15
-
-
Save yuvalherziger/f1c3047b2d4b678f8795b880a7ef1709 to your computer and use it in GitHub Desktop.
canned scenarios
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aiohttp import web | |
from aiohttp_catcher import Catcher | |
from aiohttp_catcher.canned import AIOHTTP_SCENARIOS | |
async def main(): | |
# Add a catcher: | |
catcher = Catcher() | |
# Register aiohttp web errors: | |
await catcher.add_scenario(*AIOHTTP_SCENARIOS) | |
# Register your catcher as an aiohttp middleware: | |
app = web.Application(middlewares=[catcher.middleware]) | |
web.run_app(app) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment