Skip to main content

Handler

There are handlers for:

  • static files

  • static directories

  • server health & profiling

  • jinja2 templating

Middleware

There is middleware for:

  • authentication

  • logging

  • statsd

  • cors cross-browser authorization

Example

from albatross import Server
from albatross_extras.handler import HealthHandler
from albatross_extras.middleware import (
    StatsdMiddleware,
    LoggingMiddleware,
)
from albatross_extras.lib import logging
import asyncio

class Handler:
    async def on_get(self, req, res):
        await asyncio.sleep(0.1)
        res.write('Hello, %s' % req.args['name'])

app = Server()
logger = logging.get_logger('my-app.web')
app.add_middleware(LoggingMiddleware(logger)
app.add_middleware(StatsdMiddleware())
app.add_route('/health', HealthHandler())
app.serve()
# You'll now emit stats to statsd and log in JSON format to stdout

Metadata

Release files for albatross_extras 0.2.0

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

Source distribution (sdist)

Source distribution for albatross_extras 0.2.0
File Size Uploaded
albatross_extras-0.2.0.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for albatross_extras 0.2.0
File Interpreter ABI Platform
albatross_extras-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.8 kB

Release files / albatross_extras-0.2.0.tar.gz

Download URL albatross_extras-0.2.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
08b1a337ef560cb9013e0c171e76cb2114c892b09f6d0c41cb16c57660e6b4fc
BLAKE2b-256 checksum
How to use checksums
cf546e482440f6eff95451b009ac9d5f5abed7ced4cf6c4518138438fa8e888c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / albatross_extras-0.2.0-py3-none-any.whl

Download URL albatross_extras-0.2.0-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99aa611f485566a158c3d5cb2efb7bda9b8dbb9efe0a5fb1a37347a2d91199fa
BLAKE2b-256 checksum
How to use checksums
98ca8c27b03172cd904b950eae20206d230b2ed6aaf72831283dbcf9b0dca9c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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