Skip to main content

aiohttp_debugtoolbar

|Build status| |Coverage status|

aiohttp_debugtoolbar provides a debug toolbar for your aiohttp web application. Library is port of pyramid_debugtoolbar and still in early development stages. Basic functionality has been ported:

  • basic panels

  • intercept redirects

  • intercept and pretty print exception

  • interactive python console

  • show source code

Ported Panels

HeaderDebugPanel, PerformanceDebugPanel, TracebackPanel, SettingsDebugPanel, MiddlewaresDebugPanel, VersionDebugPanel, RoutesDebugPanel, RequestVarsDebugPanel

Help Needed

Are you an experienced coder looking for a project to contribute to python/asyncio libraries? This is the project for you!

Install and Configuration

$ pip install aiohttp_debugtoolbar

In order to plug in aiohttp_debugtoolbar you have to attach middleware to your aiohttp.web.Application, and call aiohttp_debugtoolbar.setup

import aiohttp_debugtoolbar
app = web.Application(loop=loop, middlewares=[toolbar_middleware_factory])
aiohttp_debugtoolbar.setup(app)

Full Example

import asyncio
import aiohttp_debugtoolbar
import aiohttp_mako

from aiohttp import web


@aiohttp_mako.template('index.html')
def basic_handler(request):
    return {'title': 'example aiohttp_debugtoolbar!',
            'text': 'Hello aiohttp_debugtoolbar!',
            'app': request.app}


@asyncio.coroutine
def exception_handler(request):
    raise NotImplementedError


@asyncio.coroutine
def init(loop):
    # add aiohttp_debugtoolbar middleware to you application
    app = web.Application(loop=loop, middlewares=[aiohttp_debugtoolbar
                          .toolbar_middleware_factory])
    # install aiohttp_debugtoolbar
    aiohttp_debugtoolbar.setup(app)

    # install mako templates
    lookup = aiohttp_mako.setup(app, input_encoding='utf-8',
                                output_encoding='utf-8',
                                default_filters=['decode.utf8'])
    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>
    """
    lookup.put_string('index.html', template)

    app.router.add_route('GET', '/', basic_handler, name='index')
    app.router.add_route('GET', '/exc', exception_handler, name='exc_example')

    handler = app.make_handler()
    srv = yield from loop.create_server(handler, '127.0.0.1', 9000)
    print("Server started at http://127.0.0.1:9000")
    return srv, handler


loop = asyncio.get_event_loop()
srv, handler = loop.run_until_complete(init(loop))
try:
    loop.run_forever()
except KeyboardInterrupt:
loop.run_until_complete(handler.finish_connections())

Play With Demo

https://github.com/aio-libs/aiohttp_debugtoolbar/tree/master/demo

Requirements

Metadata

Release files for aiohttp-debugtoolbar 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiohttp-debugtoolbar 0.0.1
File Size Uploaded Provenance Actions
aiohttp_debugtoolbar-0.0.1.tar.gz 405.1 kB Without provenance Details for aiohttp_debugtoolbar-0.0.1.tar.gz

Release files / aiohttp_debugtoolbar-0.0.1.tar.gz

Download URL aiohttp_debugtoolbar-0.0.1.tar.gz
Size 405.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8d8811360a3bca939374f3d1a2753446e0a418af359ffdff4cb40aee0051f090
BLAKE2b-256 checksum
How to use checksums
5b8210a131c15ee5785413d56ca70f68f5dbcbacd568c7046f88e55f83086a41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for aiohttp-debugtoolbar 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page