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-2024 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.0.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

aliceio-0.2.0-py3-none-any.whl (115.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aliceio-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c7ddb5098fb9ab4cc9c12de8638be4856245097488607c8daec1b4f64a235b9e
MD5 df0e1b123a407c555d20e31079d07014
BLAKE2b-256 c6b09dbe3fff80eb99526c8b3fa12e3e5b9aaf9e2dc10dca563393f5a145220b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for aliceio-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45b8eea95bab9c3db0b8a47bd026058b75dd7d62d9efcdb13a5a5eff2bd81d6a
MD5 c64f1684e4fae0c1fcbe458ac286d5ad
BLAKE2b-256 1fc4982d4bd36b768183befa39771ac183ead98840597dd4a77eea42f98e04ad

See more details on using hashes here.

Supported by

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