aiosox-0.3.0
توضیحات
⛓️ Combination of asyncapi(documentation) & socketio pub/sub using aiokafka as the client manager multinode backend services
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | aiosox-0.3.0 |
| نام | aiosox |
| نسخه کتابخانه | 0.3.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Arie |
| ایمیل نویسنده | ariesorkin3@gmail.com |
| آدرس صفحه اصلی | https://gitlab.com/arieutils/aiosox |
| آدرس اینترنتی | https://pypi.org/project/aiosox/ |
| مجوز | - |

aiosox: <a href="https://gitlab.com/arieutils/aiosox">repo link </a>
=======================================
Quick example
-----------
can be installed using pip/poetry:
poetry shell
poetry run uvicorn example:app --port=8001
```python
from typing import List
from fastapi import FastAPI
from pydantic import BaseModel
from aiosox import SioAuth, SioNamespace, SocketIoServer
def get_app():
applitcation = FastAPI(title="tester")
return applitcation
app = get_app()
sio_server: SocketIoServer = SocketIoServer(app=app, kafka_url="localhost:29092")
user_namespapce: SioNamespace = SioNamespace("/user", socket_io_server=sio_server)
sio_server._sio.register_namespace(user_namespapce)
@app.on_event("startup")
async def on_start():
await sio_server.start()
@app.on_event("shutdown")
async def on_shutdown():
await sio_server.shutdown()
class UserY(BaseModel):
name: str
class UserT(BaseModel):
name: str
what: List[UserY]
class OfferT(BaseModel):
title: str
on_failed_emmiter = user_namespapce.create_emitter("failed", model=OfferT | UserT)
@user_namespapce.on(
"submit",
description="when user submits a form",
payload_model=UserT | UserY,
response_model=List[UserT],
auth=SioAuth.jwt,
)
async def on_submit(sid, data):
print(
sid,
data,
)
```
نیازمندی
| مقدار | نام |
|---|---|
| >=3.6.2,<4.0.0 | anyio[trio] |
| >=1.10.4,<2.0.0 | pydantic |
| >=0.8.0,<0.9.0 | aiokafka |
| >=5.7.2,<6.0.0 | python-socketio |
| >=3.8.3,<4.0.0 | orjson |
| >=1.4.2,<2.0.0 | mkdocs |
| >=9.0.2,<10.0.0 | mkdocs-material |
| >=0.88.0,<0.89.0 | fastapi |
| >=0.20.0,<0.21.0 | uvicorn[standard] |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| ==3.11.1 | Python |
نحوه نصب
نصب پکیج whl aiosox-0.3.0:
pip install aiosox-0.3.0.whl
نصب پکیج tar.gz aiosox-0.3.0:
pip install aiosox-0.3.0.tar.gz