Name | asgi_aiogram JSON |
Version |
0.3.1
JSON |
| download |
home_page | None |
Summary | fast ASGI wraper for aiogram |
upload_time | 2024-12-20 02:43:20 |
maintainer | None |
docs_url | None |
author | RootShinobi |
requires_python | <4.0,>=3.9 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
__base usage__
```python
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),
)
```
```commandline
uvicorn main:app
```
Raw data
{
"_id": null,
"home_page": null,
"name": "asgi_aiogram",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "RootShinobi",
"author_email": "111008396+RootShinobi@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/f7/61/1292e3513616c0509942cc53d4855a775f3a0dc7911d35a9a9e1927a56f2/asgi_aiogram-0.3.1.tar.gz",
"platform": null,
"description": "__base usage__\n```python\nfrom aiogram import Dispatcher, Bot\nfrom asgi_aiogram import ASGIAiogram\nfrom asgi_aiogram.strategy import SingleStrategy\nfrom asgi_aiogram.strategy import HttpStrategy\nfrom asgi_aiogram.http_responses import JsonResponse\nfrom asgi_aiogram.http_request import Request\n\ndp = Dispatcher()\n\n@dp.startup()\nasync def startup(dispatcher: Dispatcher, bot: Bot):\n await bot.close()\n await bot.set_webhook(\n url='https://example.com/bot',\n allowed_updates=dispatcher.resolve_used_update_types()\n )\n\nasync def get(request: Request):\n return JsonResponse(body={\"status\": \"ok\"})\n \nbot = Bot(token=\"<token>\")\napp = ASGIAiogram(\n SingleStrategy(path=\"/bot\", bot=bot, dispatcher=dp),\n HttpStrategy(path=\"/health\", method=\"GET\", handler=get),\n)\n```\n\n```commandline\nuvicorn main:app\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "fast ASGI wraper for aiogram",
"version": "0.3.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9381872be064b0a32c09e0a05ef3525b7dec3f3b9abc329bdb77fdbf75412754",
"md5": "607f7ddfa8d03f02fa6fc46cd7ca8d9a",
"sha256": "1c2ad301158d30bb23d41e659addba766c3966da3c2c0185951223e996e716b5"
},
"downloads": -1,
"filename": "asgi_aiogram-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "607f7ddfa8d03f02fa6fc46cd7ca8d9a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 10733,
"upload_time": "2024-12-20T02:43:17",
"upload_time_iso_8601": "2024-12-20T02:43:17.836000Z",
"url": "https://files.pythonhosted.org/packages/93/81/872be064b0a32c09e0a05ef3525b7dec3f3b9abc329bdb77fdbf75412754/asgi_aiogram-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f7611292e3513616c0509942cc53d4855a775f3a0dc7911d35a9a9e1927a56f2",
"md5": "0a87cb882665914810811f8712401853",
"sha256": "d692e7b55bd7bfe459666a22911cab3ced26fb24bf8f100d8828bae8ef4f4c42"
},
"downloads": -1,
"filename": "asgi_aiogram-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "0a87cb882665914810811f8712401853",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 6537,
"upload_time": "2024-12-20T02:43:20",
"upload_time_iso_8601": "2024-12-20T02:43:20.251959Z",
"url": "https://files.pythonhosted.org/packages/f7/61/1292e3513616c0509942cc53d4855a775f3a0dc7911d35a9a9e1927a56f2/asgi_aiogram-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-20 02:43:20",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "asgi_aiogram"
}