albatross_extras-0.2.0
توضیحات
Utilities for albatross web framework
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | albatross_extras-0.2.0 |
| نام | albatross_extras |
| نسخه کتابخانه | 0.2.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Kurt Spindler |
| ایمیل نویسنده | kespindler@gmail.com |
| آدرس صفحه اصلی | https://github.com/kespindler/albatross_extras |
| آدرس اینترنتی | https://pypi.org/project/albatross_extras/ |
| مجوز | MIT |
Extras to get up and running quickly with albatross
+++++++++++++++++++++++++++++++++++++++++++++++++++
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
=======
.. code:: python
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
نحوه نصب
نصب پکیج whl albatross_extras-0.2.0:
pip install albatross_extras-0.2.0.whl
نصب پکیج tar.gz albatross_extras-0.2.0:
pip install albatross_extras-0.2.0.tar.gz