Skip to main content

fast ASGI wraper for aiogram

Project description

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

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

asgi_aiogram-0.3.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asgi_aiogram-0.3.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file asgi_aiogram-0.3.1.tar.gz.

File metadata

  • Download URL: asgi_aiogram-0.3.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.9 Windows/10

File hashes

Hashes for asgi_aiogram-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d692e7b55bd7bfe459666a22911cab3ced26fb24bf8f100d8828bae8ef4f4c42
MD5 0a87cb882665914810811f8712401853
BLAKE2b-256 f7611292e3513616c0509942cc53d4855a775f3a0dc7911d35a9a9e1927a56f2

See more details on using hashes here.

File details

Details for the file asgi_aiogram-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: asgi_aiogram-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.9 Windows/10

File hashes

Hashes for asgi_aiogram-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c2ad301158d30bb23d41e659addba766c3966da3c2c0185951223e996e716b5
MD5 607f7ddfa8d03f02fa6fc46cd7ca8d9a
BLAKE2b-256 9381872be064b0a32c09e0a05ef3525b7dec3f3b9abc329bdb77fdbf75412754

See more details on using hashes here.

Supported by

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