base usage
from aiogram import Dispatcher, Bot
from asgi_aiogram import ASGIAiogram
from asgi_aiogram.strategy import SingleStrategy
from asgi_aiogram.strategy import HttpStrategy
from asgi_aiogram.http_responses import JsonResponse
from asgi_aiogram.http_request import Request
dp = Dispatcher()
@dp.startup()
async def startup(dispatcher: Dispatcher, bot: Bot):
await bot.close()
await bot.set_webhook(
url='https://example.com/bot',
allowed_updates=dispatcher.resolve_used_update_types()
)
async def get(request: Request):
return JsonResponse(body={"status": "ok"})
bot = Bot(token="<token>")
app = ASGIAiogram(
SingleStrategy(path="/bot", bot=bot, dispatcher=dp),
HttpStrategy(path="/health", method="GET", handler=get),
)
uvicorn main:app
Metadata
Release files for asgi_aiogram 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asgi_aiogram-0.3.1.tar.gz | 6.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asgi_aiogram-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.3 kB
Release files / asgi_aiogram-0.3.1.tar.gz
| Download URL | asgi_aiogram-0.3.1.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d692e7b55bd7bfe459666a22911cab3ced26fb24bf8f100d8828bae8ef4f4c42
|
|
BLAKE2b-256 checksum How to use checksums |
f7611292e3513616c0509942cc53d4855a775f3a0dc7911d35a9a9e1927a56f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.9 Windows/10
|
Release files / asgi_aiogram-0.3.1-py3-none-any.whl
| Download URL | asgi_aiogram-0.3.1-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c2ad301158d30bb23d41e659addba766c3966da3c2c0185951223e996e716b5
|
|
BLAKE2b-256 checksum How to use checksums |
9381872be064b0a32c09e0a05ef3525b7dec3f3b9abc329bdb77fdbf75412754
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.9 Windows/10
|