Skip to main content

Yay! API client SDK

Project description

yaylib

yaylib

好きでつながるバーチャルワールド - Yay! の API ライブラリ

Python

あらゆる操作の自動化や、ボットの開発が可能です。

Discord に参加

Yay! の API を Python から扱うための非公式 SDK です。

インストール

pip install yaylib

対応バージョン: Python 3.10 / 3.11 / 3.12 / 3.13

クイックスタート

import asyncio
import yaylib


async def main():
    # `async with` で接続が自動的にクローズされます
    async with yaylib.Client() as client:
        # ログイン(セッションは透過的にキャッシュされます)
        await client.login_with_email(email="...", password="...")

        # タイムラインを取得
        timeline = await client.get_timeline(
            noreply_mode=yaylib.NoreplyMode.EMPTY, number=20
        )
        for post in timeline.posts:
            print(post.id, post.text)

        # 投稿する
        await client.create_post(
            x_jwt=client.generate_x_jwt(),
            post_type="text",
            text="hello from yaylib",
        )


asyncio.run(main())

すべてのオペレーションは client.<operation> として直接呼び出せます。

イベントストリーム

async with client.open_event_stream() as stream:
    sub = stream.subscribe(yaylib.chat_room_channel())

    # 新着メッセージを受信
    @sub.on_new_message
    async def _(event):
        print("new message:", event)

    await sub.wait_closed()

サンプル

実行できるサンプルを examples/ に用意しています(全言語共通)。

  • 認証 + タイムライン取得
  • テキスト投稿
  • イベントストリームの簡単なボット
  • セッション永続化とエラー処理
YAY_EMAIL=... YAY_PASSWORD=... python examples/python/timeline.py

⚖️ ライセンス

MIT © ekkx

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

yaylib-2.1.0.tar.gz (270.2 kB view details)

Uploaded Source

Built Distribution

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

yaylib-2.1.0-py3-none-any.whl (864.7 kB view details)

Uploaded Python 3

File details

Details for the file yaylib-2.1.0.tar.gz.

File metadata

  • Download URL: yaylib-2.1.0.tar.gz
  • Upload date:
  • Size: 270.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yaylib-2.1.0.tar.gz
Algorithm Hash digest
SHA256 e42d71d8d46e6c1f1ecb183f894224e67145dabe73a65bcc2a69e9d56172e012
MD5 626198c5b3b10b67b11d794bab8c8e89
BLAKE2b-256 205642999de20db1ccb8938c357ea874d3aaec9907b52ad141ee57d604ec3896

See more details on using hashes here.

File details

Details for the file yaylib-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: yaylib-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 864.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yaylib-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aeaf92ed03d5a90fec47b895730e2d2e5380c456c342a22d2529f894e543054a
MD5 b1a958644b8599be5dd1f4ce749f7980
BLAKE2b-256 6b4e52620aac009e202d5bc8debd95ee43fd28ebe8038797ced761420976ab91

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