Utilities for albatross web framework
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file albatross_extras-0.2.0.tar.gz
.
File metadata
- Download URL: albatross_extras-0.2.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08b1a337ef560cb9013e0c171e76cb2114c892b09f6d0c41cb16c57660e6b4fc |
|
MD5 | 434ec15cdc329e114c803952cb949bca |
|
BLAKE2b-256 | cf546e482440f6eff95451b009ac9d5f5abed7ced4cf6c4518138438fa8e888c |
File details
Details for the file albatross_extras-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: albatross_extras-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99aa611f485566a158c3d5cb2efb7bda9b8dbb9efe0a5fb1a37347a2d91199fa |
|
MD5 | b0a53bc9e6b32e4ba206a3f7af71058f |
|
BLAKE2b-256 | 98ca8c27b03172cd904b950eae20206d230b2ed6aaf72831283dbcf9b0dca9c0 |