Metadata-Version: 2.4
Name: monopane
Version: 0.2.0
Summary: Python SDK for the Monopane API: courses, learners, enrollments, progress and quizzes.
Author: Monopane
License-Expression: MIT
Project-URL: Homepage, https://monopane.io
Project-URL: Documentation, https://api.monopane.io/docs
Keywords: monopane,education,learning,edtech,api,sdk
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: urllib3<3.0.0,>=2.7.0
Requires-Dist: python-dateutil>=2.8.2
Requires-Dist: pydantic>=2.11
Requires-Dist: typing-extensions>=4.7.1
Dynamic: license-file

# Monopane Python SDK

Python client for the [Monopane](https://monopane.io) API: courses, modules, lessons and activities; learners, enrollments, progress and quizzes; webhooks.

API reference: https://api.monopane.io/docs

## Install

```sh
pip install monopane
```

Requires Python 3.11 or newer.

## Authentication

Create an API key in the Monopane console. Keys start with `mpk_live_` (or `mpk_test_` for test mode) and belong to one tenant (project).

## Usage

```python
import os
import monopane

config = monopane.Configuration(
    host="https://api.monopane.io",
    access_token=os.environ["MONOPANE_API_KEY"],
)
tenant_id = "tnt_..."

with monopane.ApiClient(config) as client:
    courses = monopane.CoursesApi(client)

    course = courses.create_course(
        tenant_id,
        monopane.CreateCourseRequest(title="Intro to SQL", slug="intro-to-sql"),
    )

    page = courses.list_courses(tenant_id)
    print(len(page.data), page.next_cursor)
```

Errors raise `monopane.ApiException`, with `.status` and `.body`.

## Quiz answers

Quiz answers are a union type. Build each one from its model and wrap it in `SubmissionAnswer`:

```python
answer = monopane.SubmissionAnswer(
    monopane.MultipleChoiceAnswer(question_id="q1", type="multiple_choice", answer="4")
)
monopane.SubmissionsApi(client).create_submission(
    tenant_id,
    enrollment_id,
    monopane.CreateSubmissionRequest(activity_id=activity_id, answers=[answer]),
)
```

Do not pass a plain `dict` in `answers`: the SDK serializes it as `null` and the API rejects the request.

## About this package

The client is generated from the Monopane OpenAPI document with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator). In the source repository everything except this README and `pyproject.toml` is generated; regenerate with `pnpm sdk:generate` instead of editing it.
