Skip to main content

Asynchronous framework for Alice from Yandex Dialogs

Project description

aliceio

AliceIO

License Status PyPI Downloads GitHub Repo stars Supported python versions Tests Coverage

Асинхронный фреймворк для разработки навыков Алисы из Яндекс.Диалогов

Based on aiogram v3

Особенности

Важно!

Рекомендуется иметь опыт работы с asyncio перед использованием aliceio

Быстрый старт

Как получить skill_id и подключить навык к Алисе можно прочитать тут.

Yandex Cloud Functions:

from aliceio import Dispatcher, Skill
from aliceio.types import Message
from aliceio.webhook.yandex_functions import OneSkillYandexFunctionsRequestHandler

dp = Dispatcher()
skill = Skill(skill_id="...")
requests_handler = OneSkillYandexFunctionsRequestHandler(dispatcher=dp, skill=skill)

@dp.message()
async def hello(message: Message) -> str:
    return f"Привет, {message.session.application.application_id}!"

async def main(event, context):
    return await requests_handler(event, context)

Вебхук:

from aiohttp import web
from aliceio import Dispatcher, Skill
from aliceio.types import Message
from aliceio.webhook.aiohttp_server import OneSkillAiohttpRequestHandler, setup_application

dp = Dispatcher()
skill = Skill(skill_id="...")

@dp.message()
async def hello(message: Message) -> str:
    return f"Привет, {message.session.application.application_id}!"

def main() -> None:
    app = web.Application()
    requests_handler = OneSkillAiohttpRequestHandler(dispatcher=dp, skill=skill)

    WEB_SERVER_HOST = "127.0.0.1"
    WEB_SERVER_PORT = 80
    WEBHOOK_PATH = "/alice"

    requests_handler.register(app, path=WEBHOOK_PATH)
    setup_application(app, dp, skill=skill)
    web.run_app(app, host=WEB_SERVER_HOST, port=WEB_SERVER_PORT)

if __name__ == "__main__":
    main()

Материалы

Связь

Если у вас есть вопросы, вы можете задать их в Телеграм чате

Лицензия

Copyright © 2023-2025 K1rL3s and ZloyKobra
Этот проект использует MIT лицензию

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

aliceio-0.2.3.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

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

aliceio-0.2.3-py3-none-any.whl (116.0 kB view details)

Uploaded Python 3

File details

Details for the file aliceio-0.2.3.tar.gz.

File metadata

  • Download URL: aliceio-0.2.3.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for aliceio-0.2.3.tar.gz
Algorithm Hash digest
SHA256 25921e02a1ae77c11f3c9c857fad7488f7df34b23ca78446d6075109bf4461d1
MD5 47bf27279156bbcd1c8a8a63c21b2649
BLAKE2b-256 3d80eec2b916a10a54b4611f1361dece09a3a9b632a5c17c044ee1aa5782ac25

See more details on using hashes here.

File details

Details for the file aliceio-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: aliceio-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 116.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for aliceio-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7e9db18b6bcff253965ca340ad61ef77d7d749beb07ca7597aabdf075423e586
MD5 21aeced7fefc9ad779ef78ea380ff64b
BLAKE2b-256 34ef352f783f57a50a3503d11af94f55eb55eab7d7774761b6f8b27143c0aad5

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