Skip to main content

eduskit

Python B 端 Server SDK。sdk.client 调课堂 server-api,sdk.whiteboard_client 调白板 server-api。

方法名为 snake_case;请求/响应 JSON 字段仍为 camelCase(originId、eduUserId)。

概念与方法表见 docs/overview.md、docs/api.md。

安装

pip install -e .

要求 Python 3.9+,无第三方运行时依赖(标准库 urllib)。

PYTHONPATH=. python3 -m unittest tests.test_eduskit -v

初始化

from eduskit import Eduskit, EduskitError

sdk = Eduskit(
    timeout_ms=10_000,
    lang="zh-CN",
    client={
        "base_url": "http://localhost:3112",
        "app_id": "app_edu",
        "app_key": "edu_key",
        "app_secret": "edu_secret",
    },
    whiteboard_client={
        "base_url": "http://localhost:3012",
        "app_id": "app_wb",
        "app_key": "wb_key",
        "app_secret": "wb_secret",
    },
)

配置字典键是 snake_case(base_url / app_id / app_key / app_secret)。两侧均可选。

课堂 sdk.client

user = sdk.client.users.register(
    originId="stu_001",
    nickname="小明",
    avatar="https://example.com/a.png",
)
token = sdk.client.auth.issue_token(eduUserId=user["eduUserId"], originId="stu_001")
classroom = sdk.client.classrooms.create(
    name="一年级数学",
    startsAt="2026-08-17T10:00:00.000Z",
    durationMinutes=60,
    teacherEduUserId=user["eduUserId"],
)
sdk.client.classrooms.start(classroom["classroomId"])
sdk.client.classrooms.members.add(
    classroom["classroomId"],
    eduUserId=user["eduUserId"],
    role="student",
)
sdk.client.classrooms.members.replace_students(
    classroom["classroomId"],
    eduUserIds=[user["eduUserId"]],
)
sdk.client.classrooms.permissions.set(
    classroom["classroomId"],
    user["eduUserId"],
    permission="camera",
    effect="grant",
    operatorEduUserId=user["eduUserId"],
)
sdk.client.classrooms.coursewares.bind(
    classroom["classroomId"],
    coursewareIds=["cw_xxx"],
)
sdk.client.app.get_ui_config()
方法 对应 Node
users.register(**input) users.register
auth.issue_token(**input) auth.issueToken
classrooms.create/start/end 同名
classrooms.members.add/list 同名
classrooms.members.replace_students replaceStudents
classrooms.permissions.get/set/clear 同名
classrooms.coursewares.list/bind/unbind 同名
app.get_ui_config / set_ui_config getUiConfig / setUiConfig

白板 sdk.whiteboard_client

credential = sdk.whiteboard_client.auth.issue_room_token(
    roomId="room_1",
    userId=user["eduUserId"],
    role="host",
    expiresIn=3600,
)
session = sdk.whiteboard_client.recordings.start("room_1", externalRef="lesson_001")
sdk.whiteboard_client.recordings.stop("room_1", recordingId=session["recordingId"])
sdk.whiteboard_client.recordings.enqueue_video_export(session["recordingId"], profile="hd")
sdk.whiteboard_client.files.convert(sourceUrl="https://cdn.example.com/lesson.pptx")
方法 对应 Node
auth.issue_room_token issueRoomToken
recordings.start/stop/list/get 同名
recordings.register_media_asset / delete_media_asset camelCase 版
recordings.enqueue_video_export / get_video_export camelCase 版
captures.create/list 同名
files.convert / get_convert_job getConvertJob

错误

try:
    sdk.client.auth.issue_token(eduUserId="")
except EduskitError as e:
    print(e.error_code, e.status, e.trace_id, e.source)

sdk.client.last_trace_id / sdk.whiteboard_client.last_trace_id。

示例

Application business APIs

Use the application-credential client for user lists and status, classroom queries and updates, courseware libraries, live assets, attendance, entry diagnostics, and activity logs. No console tenant token is required. See the complete API reference. New methods require a matching server-api deployment and a source SDK build.

Console management

ConsoleClient exposes tenant management, authentication, applications, users, classrooms, courseware, live video, diagnostics, dashboards, and billing. Use the console-api URL and a tenant access token. Application-scoped methods require appId; app credentials are not sent by this client. This API is available in this source build.

import os
from eduskit import Eduskit
sdk = Eduskit(console_client={
    "base_url": os.environ["EDU_CONSOLE_URL"],
    "access_token": os.environ["EDU_TENANT_ACCESS_TOKEN"],
})
c = sdk.console_client
apps = c.apps.list()
users = c.users.list(os.environ["EDU_APP_ID"], page=1, pageSize=20)

Full API fields and workflows: Console management.

Metadata

Release files for eduskit 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eduskit 0.1.6
File Size Uploaded Provenance
eduskit-0.1.6.tar.gz 21.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for eduskit 0.1.6
File Interpreter ABI Platform
eduskit-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 40.9 kB

Release files / eduskit-0.1.6.tar.gz

Download URL eduskit-0.1.6.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f289f2d989b9aab051335734bd8fa6ff0093d29da1a4ed0deeca31af2b6f84d5
BLAKE2b-256 checksum
How to use checksums
27a89e686185d81137015da0bee64611543646962db9ba0648444452aaeebfb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / eduskit-0.1.6-py3-none-any.whl

Download URL eduskit-0.1.6-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b37ebda8eda13511ce6585407a14e204e77851879935b8ca821c2274fb6e78e7
BLAKE2b-256 checksum
How to use checksums
e85723b96d60e23862677ce1d10cc79000c84d1af8046a41c0c4e57bf66e0dd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for eduskit 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for eduskit-0.1.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page