Skip to main content

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)

Source distribution for asgi_aiogram 0.3.1
File Size Uploaded
asgi_aiogram-0.3.1.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for asgi_aiogram 0.3.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page