Package: aiohttp-debugtoolbar
aiohttp-debugtoolbaraiohttp_debugtoolbarprovides a debug toolbar for youraiohttpweb application.  Library is port ofpyramid_debugtoolbarand
still in early development stages. Basic functionality has been
ported:basic panelsintercept redirectsintercept and pretty print exceptioninteractive python consoleshow source codePorted PanelsHeaderDebugPanel,PerformanceDebugPanel,TracebackPanel,SettingsDebugPanel,MiddlewaresDebugPanel,VersionDebugPanel,RoutesDebugPanel,RequestVarsDebugPanel,LoggingPanelHelp NeededAre you coder looking for a project to contribute to
python/asyncio libraries? This is the project for you!Install and Configuration$ pip install aiohttp_debugtoolbarIn order to plug inaiohttp_debugtoolbar, callaiohttp_debugtoolbar.setupon your app.importaiohttp_debugtoolbarapp=web.Application(loop=loop)aiohttp_debugtoolbar.setup(app)Full Exampleimportasyncioimportjinja2importaiohttp_debugtoolbarimportaiohttp_jinja2fromaiohttpimportweb@aiohttp_jinja2.template('index.html')asyncdefbasic_handler(request):return{'title':'example aiohttp_debugtoolbar!','text':'Hello aiohttp_debugtoolbar!','app':request.app}asyncdefexception_handler(request):raiseNotImplementedErrorasyncdefinit(loop):# add aiohttp_debugtoolbar middleware to you applicationapp=web.Application(loop=loop)# install aiohttp_debugtoolbaraiohttp_debugtoolbar.setup(app)template="""
    <html>
        <head>
            <title>{{ title }}</title>
        </head>
        <body>
            <h1>{{ text }}</h1>
            <p>
              <a href="{{ app.router['exc_example'].url() }}">
              Exception example</a>
            </p>
        </body>
    </html>
    """# install jinja2 templatesloader=jinja2.DictLoader({'index.html':template})aiohttp_jinja2.setup(app,loader=loader)# init routes for index page, and page with errorapp.router.add_route('GET','/',basic_handler,name='index')app.router.add_route('GET','/exc',exception_handler,name='exc_example')returnapploop=asyncio.get_event_loop()app=loop.run_until_complete(init(loop))web.run_app(app,host='127.0.0.1',port=9000)Settingsaiohttp_debugtoolbar.setup(app,hosts=['172.19.0.1',])Supported optionsenabled: The debugtoolbar is disabled if False. By default is set to True.intercept_redirects: If True, intercept redirect and display an intermediate page with a link to the redirect page. By default is set to True.hosts: The list of allow hosts. By default is set to [‘127.0.0.1’, ‘::1’].exclude_prefixes: The list of forbidden hosts. By default is set to [].check_host: If False, disable the host check and display debugtoolbar for any host. By default is set to True.max_request_history: The max value for storing requests. By default is set to 100.max_visible_requests: The max value of display requests. By default is set to 10.path_prefix: The prefix of path to debugtoolbar. By default is set to ‘/_debugtoolbar’.Thanks!I’ve borrowed a lot of code from following projects. I highly
recommend to check them out:pyramid_debugtoolbardjango-debug-toolbarflask-debugtoolbarPlay With Demohttps://github.com/aio-libs/aiohttp_debugtoolbar/tree/master/demoRequirementsaiohttpaiohttp_jinja2CHANGES0.6.1 (2023-11-19)Filtered out requests to debugtoolbar itself from the requests history.Improved import time by delaying loading of package data.Fixed static URLs when using yarl 1.9+.Fixed a warning in theremodule.Switched toaiohttp.web.AppKeyfor aiohttp 3.9.Dropped Python 3.7 and added Python 3.11.0.6.0 (2020-01-25)Fixed ClassBasedView support. #207Dropped aiohttp<3.3 support.Dropped Python 3.4 support.Droppedyield fromand@asyncio.coroutinesupport.0.5.0 (2018-02-14)Added safe filter to render_content. #195Added support for aiohtp 3.0.4.1 (2017-08-30)Fixed issue with redirects without location header. #1740.4.0 (2017-05-04)Added asyncio trove classifier.Addes support for aiohttp 2.0.7+.0.3.0 (2016-11-18)Fixed middleware route finding when using sub-apps. #65Added examples for extra panels: pgsql & redis monitor. #590.2.0 (2016-11-08)Refactored test suite.0.1.4 (2016-11-07)Renamed to aiohttp-debugtoolbar.Fixed imcompatibility with aiohttp 1.1.0.1.3 (2016-10-27)Fixed a link to request info page, sort request information alphabetically. #520.1.2 (2016-09-27)Fixed empty functions names in performance panel. #43 (Thanks @kammala!)Fixed flashing message during page rendering issue. #460.1.1 (2016-02-21)Fixed a demo.Added syntax highlight in traceback view, switched highlighter from
highlight.js to prism.js. #310.1.0 (2016-02-13)Added Python 3.5 support. (Thanks @stormandco!)Added view source button in RoutesDebugPanel. (Thanks @stormandco!)Dropped support for Python 3.3. (Thanks @sloria!)Added middleware in setup method. (Thanks @sloria!)Fixed bug with interactive console.Fixed support for aiohttp>=0.21.1.0.0.5 (2015-09-13)Fixed IPv6 socket family error. (Thanks @stormandco!)0.0.4 (2015-09-05)Fixed support for aiohttp>=0.17. (Thanks @himikof!)0.0.3 (2015-07-03)Switched template engine from mako to jinja2. (Thanks @iho!)Added customyield fromto track context switches inside coroutine.Implemented panel for collecting request log messages.Disable toolbar code injecting for non web.Response answers
(StreamResponse or WebSocketResponse for example). #120.0.2 (2015-05-26)Redesigned UI look-and-feel.Renamedtoolbar_middleware_factoryto justmiddleware.0.0.1 (2015-05-18)Initial release.