Skip to main content

An SDK for the Hive LMS API

Project description

HiveLMS Python Client

A typed Python SDK for the Hive LMS REST API, built on Pydantic v2 and requests.

This package provides a clean, Pydantic-validated interface to every Hive REST endpoint. Instead of crafting raw HTTP requests and parsing JSON by hand you work with:

  • Handler objects — one per resource, accessed as attributes on the main client.
  • Pydantic models — fully typed request bodies (*Input / *Patch) and response objects.
  • Automatic auth — JWT tokens are fetched and refreshed transparently on every request.

Full documentation at jan-oko.github.io →
Repo and source code at GitHub →

Installation

uv add hivelms-client

Python 3.12+ is required.


Quick Start

from hivelms_client import HiveClient
from hivelms_client.models.assignments.assignment import AssignmentInput
from hivelms_client.models.assignments.assignment import AssignmentPatch, AssignmentStatus

client = HiveClient(
    host="hive.example.com",
    username="admin0",
    password="secret",
    port=443,  # default
    use_https=True,  # default
    verify_certs=True,
)

# List all programs
programs = client.course_handler.programs.search()

# Create an assignment
assignment = client.assignments_handler.create(
    AssignmentInput(exercise=5, user=12)
)

# Partial update
client.assignments_handler.patch(
    assignment.id,
    AssignmentPatch(assignment_status=AssignmentStatus.DONE),
)

Authentication is lazy — a JWT is fetched on the first request and silently refreshed on 401 responses.


Handler Map

All resources are accessed through handler namespaces on the client:

Attribute What it covers
client.assignments_handler Assignments and their responses
client.course_handler Programs, subjects, modules, exercises, form fields
client.help_handler Help threads and their responses
client.management_handler Users, classes, seating, registration
client.queues_handler Queues and queue items
client.schedule_handler Lessons, lesson rules, calendar events, event colors, daily review
client.tags_handler Tags
client.notifications_handler Notifications
client.token_handler JWT token creation and refresh
client.time_handler Server time

Sub-resource handlers are nested attributes (e.g. client.queues_handler.items, client.course_handler.exercises.fields).


Discriminated Unions

Several models use Pydantic discriminated unions. Pass the concrete subtype:

from hivelms_client.models.management.users.student import StudentUserInput

student = client.management_handler.users.create(
    StudentUserInput(username="alice", program=1, number=42, ...)
)

Key unions:

Union Discriminator Subtypes
User / UserInput clearance StudentUser, CheckerUser, StaffUser
Queue / QueueInput module / user field ModuleQueue, UserQueue
FormField / FormFieldInput has_valuetype UnfillableFormField, TextFormField, NumericFormField, RadioFormField, CheckboxesFormField
Notification / NotificationInput assignment vs help ExerciseNotification, HelpNotification

Testing

Integration tests spin a hive instance and thus require a hive repo:

cd tests/integration
HIVE_REPO=/path/to/a/local/repo uv run pytest tests/integration/ -m integration -v

Documentation

Full API reference, guides, and a tutorial are available at:

https://jan-oko.github.io/HiveLMS-Client/

To build and serve the docs locally:

uv run mkdocs serve

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

hivelms_client-1.0.1-py3-none-any.whl (78.2 kB view details)

Uploaded Python 3

File details

Details for the file hivelms_client-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: hivelms_client-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 78.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hivelms_client-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2ce9ac1f57289cdd7469b2296852bd1e3474f71808d40bfbbcb8514b3477294d
MD5 3d69a044c4d4d20fa4b627efc10df6ac
BLAKE2b-256 4bc0ab2daac90e3872d282660e743691d8e2f7d65804509d44cb0a743e224f9a

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