Yandex Dialogs Developer API client — programmatic skill creation, draft management, OAuth Device Flow
Project description
ya-dialogs-api
Async Yandex Dialogs Developer API client — programmatic skill creation, draft management, OAuth Device Flow.
What this is
A framework-agnostic Python library that drives the Yandex Dialogs Developer
API — the meta-API at dialogs.yandex.ru/developer-api/v2/ used to
programmatically create and manage Alice skills (Smart Home and custom dialog
skills). Where every other Yandex Alice library on PyPI handles the runtime
side (incoming webhook requests from end users), this one handles the
provisioning side: sign in via Yandex Passport Device Flow, create a skill,
upload a logo, set the webhook backend URL, publish a draft, poll for
publication state.
It exists because Yandex doesn't publish a developer-API SDK and the only
known Python implementation lived inside the Music Assistant
ma-provider-yandex-smarthome plugin. This library is that code, extracted
and made generic.
Features
- Full skill auto-creation pipeline — Device Flow OAuth → CSRF/cookie
session → POST
/apps→ POST/skills/{id}/draft→ publication polling → callback URL extraction. - Two channel types —
skill_type="smart_home"for Yandex Smart Home skills,skill_type="dialog"for Alice custom dialog (aliceSkill) skills. - Incremental state machine —
SkillCreationArtifactssnapshots progress after every step. On transient failure, retry resumes from the last completed step instead of restarting. - Framework-agnostic — caller provides a
WebserverAdapterProtocol implementation for hosting the short-lived Device Code activation page. Works with aiohttp, FastAPI, Starlette, or any ASGI/aiohttp-compatible webserver. - Strictly typed —
mypy --strictclean, PEP 561py.typedmarker. - Security-aware —
SecretStrredacts tokens in repr/str/format/tracebacks (re-exported fromya-passport-auth).
Installation
pip install ya-dialogs-api
Quick start
import asyncio
from ya_dialogs_api import (
SkillCreationArtifacts,
SkillCreationState,
WebserverAdapter,
auto_create_skill,
load_default_logo_bytes,
)
# 1. Implement WebserverAdapter against your HTTP framework.
# See docs for an aiohttp reference implementation.
my_webserver: WebserverAdapter = ...
# 2. Drive the pipeline. Persist artifacts between calls — the next
# invocation will resume from the last completed step.
async def main() -> None:
artifacts = SkillCreationArtifacts(state=SkillCreationState.PENDING)
result = await auto_create_skill(
webserver=my_webserver,
connection_type="direct",
skill_name="My Smart Home",
artifacts=artifacts,
cloud_instance_id="...",
direct_client_secret="...",
logo_bytes=load_default_logo_bytes(),
session_id="cfg-flow-1",
skill_type="smart_home",
)
if result.state == SkillCreationState.DONE:
print(f"Skill created: skill_id={result.skill_id}")
else:
print(f"Failed at step {result.state}: {result.last_error}")
asyncio.run(main())
Status
Beta. The API is stable enough to depend on, but the underlying Yandex dev- console endpoints are unofficial (reverse-engineered from DevTools traces) and may break without notice. The library is actively maintained against the current production endpoint behavior.
See also
ya-passport-auth— Yandex Passport authentication library. Required runtime dependency for the OAuth Device Flow used by this library.ma-provider-yandex-smarthomeandma-provider-yandex-alice— Music Assistant providers that consume this library.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ya_dialogs_api-1.0.0.tar.gz.
File metadata
- Download URL: ya_dialogs_api-1.0.0.tar.gz
- Upload date:
- Size: 73.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b563acbda0d8a390c0879ff4f0754274b7fd34d30cc524a2b8385554b3758fe9
|
|
| MD5 |
01e5c03edc3405dbfb0c2b66d00bc008
|
|
| BLAKE2b-256 |
2086cfb86341d4a1c8c2f8fa9150e7b68846a5abfee3cf7b236a01a43563f750
|
Provenance
The following attestation bundles were made for ya_dialogs_api-1.0.0.tar.gz:
Publisher:
release.yml on trudenboy/ya-dialogs-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ya_dialogs_api-1.0.0.tar.gz -
Subject digest:
b563acbda0d8a390c0879ff4f0754274b7fd34d30cc524a2b8385554b3758fe9 - Sigstore transparency entry: 1448658001
- Sigstore integration time:
-
Permalink:
trudenboy/ya-dialogs-api@a42d57140f3207f4458c90b02fbef0aa4475e35e -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/trudenboy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a42d57140f3207f4458c90b02fbef0aa4475e35e -
Trigger Event:
push
-
Statement type:
File details
Details for the file ya_dialogs_api-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ya_dialogs_api-1.0.0-py3-none-any.whl
- Upload date:
- Size: 62.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
454bdf14f796e0299a01a3f14e08541c94915b4f798bd22b3a9345abc47da651
|
|
| MD5 |
bc6595cafc1b7b960b9abf2072260190
|
|
| BLAKE2b-256 |
e2a4699a56caf5c22fb6f3b40055bed8fb6fd01cb466b7b994467acde992fb0a
|
Provenance
The following attestation bundles were made for ya_dialogs_api-1.0.0-py3-none-any.whl:
Publisher:
release.yml on trudenboy/ya-dialogs-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ya_dialogs_api-1.0.0-py3-none-any.whl -
Subject digest:
454bdf14f796e0299a01a3f14e08541c94915b4f798bd22b3a9345abc47da651 - Sigstore transparency entry: 1448658071
- Sigstore integration time:
-
Permalink:
trudenboy/ya-dialogs-api@a42d57140f3207f4458c90b02fbef0aa4475e35e -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/trudenboy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a42d57140f3207f4458c90b02fbef0aa4475e35e -
Trigger Event:
push
-
Statement type: