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
Metadata
Release files for yaylib 2.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yaylib-2.3.0.tar.gz | 274.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yaylib-2.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.1 MB
Release files / yaylib-2.3.0.tar.gz
| Download URL | yaylib-2.3.0.tar.gz |
|---|---|
| Size | 274.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7350ef2382f77168f6e3e7e8941dc8ffa27f4e9a23160cf3cd2462c56247ce31
|
|
BLAKE2b-256 checksum How to use checksums |
466738b9184058f14a7e3359a6c941580f82ac22ab7734edbba509889ddb6063
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / yaylib-2.3.0-py3-none-any.whl
| Download URL | yaylib-2.3.0-py3-none-any.whl |
|---|---|
| Size | 869.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ded6dd932ef194049a4414b0cf9bef6755269c1b1a58f200af1d1a2362c312a
|
|
BLAKE2b-256 checksum How to use checksums |
e60fc4b29b08fb64e016667590c4d8569cb0e933a2b2e1fea94f0be1c03732a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|