Skip to main content

ASGI server for amqp rpc protocol

Project description

Vilha

Rpc server inspired by nameko and aims to extend asgi protocol to allow use of asgi middlewares and starlette with DI inspired by FastAPI

Example

import asyncio
from vilha.server import Vilha
from vilha.starlette.applications import RpcRoute, Starlette
from vilha.di import Depends
import random

async def get_rnd():
    return random.randint(0,100)

async def test_method(rnd: Annotated[int, Depends(get_rnd)]):
    print("test_method")
    return rnd


st = Starlette(routes=[RpcRoute("test_method", test_method)])


async def main():
    await Vilha("test_service").run(st)


loop = asyncio.get_event_loop()
loop.create_task(main())

loop.run_forever()

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

vilha-0.0.2.tar.gz (9.3 kB view hashes)

Uploaded Source

Built Distribution

vilha-0.0.2-py3-none-any.whl (14.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page