Skip to content

Instantly share code, notes, and snippets.

@yuvalherziger
Created January 6, 2022 19:15
Show Gist options
  • Save yuvalherziger/f1c3047b2d4b678f8795b880a7ef1709 to your computer and use it in GitHub Desktop.
Save yuvalherziger/f1c3047b2d4b678f8795b880a7ef1709 to your computer and use it in GitHub Desktop.
canned scenarios
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