Skip to main content

Unofficial API interface to the smartschool system.

Project description

Smartschool Parser

codecov

Unofficial Python library to interface with Smartschool's web platform, providing programmatic access to courses, documents, messages, results, and more.

Quick Start

Copy credentials.yml.example to credentials.yml and configure with your credentials:

username: your_username
password: your_password
main_url: your_school.smartschool.be
mfa: your_birthday_or_2fa_secret
from smartschool import Smartschool, PathCredentials, Courses

session = Smartschool(PathCredentials())
for course in Courses(session):
    print(course.name)

Features

Course Management

  • Courses: List all available courses
  • TopNavCourses: Navigation bar courses with document access
  • Document Browser: Navigate and download course documents and folders
  • File Downloads: Support for various file types with automatic extension detection

Academic Information

  • Results: Retrieve grades and evaluations with detailed feedback
  • Periods: Academic periods and terms
  • FutureTasks: Upcoming assignments and deadlines
  • PlannedElements: Scheduled assignments and activities

Communication

  • Messages: Full inbox/outbox management with attachments
  • Message Operations: Mark as read/unread, archive, delete, label management
  • Attachments: Download message attachments

Calendar & Schedule

  • AgendaLessons: Daily lesson schedules
  • AgendaHours: Class period definitions
  • AgendaMomentInfos: Detailed lesson information

Support

  • StudentSupportLinks: Access to support resources

Authentication

Supports multiple authentication methods:

  • Standard login: Username/password
  • Security question: Birthday verification
  • 2FA: Google Authenticator (requires pyotp)
# Environment variables
from smartschool import Smartschool, EnvCredentials
session = Smartschool(EnvCredentials())

# Direct credentials
from smartschool import Smartschool, AppCredentials
creds = AppCredentials(
    username="user",
    password="pass", 
    main_url="school.smartschool.be",
    mfa="birthday_or_2fa"
)
session = Smartschool(creds)

Advanced Usage

Document Management

from smartschool import TopNavCourses

for course in TopNavCourses(session):
    print(f"Course: {course.name}")
    for item in course.items:
        if isinstance(item, FileItem):
            item.download_to_dir(Path("downloads"))
        elif isinstance(item, FolderItem):
            # Navigate into subfolders
            for subitem in item.items:
                print(f"  - {subitem.name}")

Message Processing

from smartschool import MessageHeaders, Message, BoxType

for header in MessageHeaders(session, box_type=BoxType.INBOX):
    full_message = Message(session, header.id).get()
    print(f"From: {full_message.from_}")
    print(f"Subject: {full_message.subject}")
    print(f"Body: {full_message.body}")

Results Analysis

from smartschool import Results, ResultDetail

for result in Results(session):
    print(f"{result.name}: {result.graphic.achieved_points}/{result.graphic.total_points}")
    
    # Get detailed information
    detail = ResultDetail(session, result.identifier).get()
    print(f"Teacher feedback: {detail.feedback}")

Task Management

from smartschool import FutureTasks, PlannedElements

# Upcoming assignments
for day in FutureTasks(session):
    print(f"Date: {day.date}")
    for course in day.courses:
        for task in course.items.tasks:
            print(f"  {task.label}: {task.description}")

# Planned activities
for element in PlannedElements(session):
    print(f"{element.name} - {element.period.dateTimeFrom}")

Scripts

The package includes several utility scripts:

  • smartschool_browse_docs: Interactive document browser
  • smartschool_download_all_documents: Bulk download all course documents
  • smartschool_report_on_*: Email notification scripts for tasks and results

API Reference

Core Classes

  • Smartschool: Main session handler
  • PathCredentials, EnvCredentials, AppCredentials: Authentication methods

Data Access

  • Courses, TopNavCourses: Course information
  • Results, ResultDetail: Grade management
  • MessageHeaders, Message, Attachments: Communication
  • FutureTasks, PlannedElements: Task scheduling
  • Periods: Academic terms
  • StudentSupportLinks: Support resources

File Management

  • FileItem, FolderItem, InternetShortcut: Document types
  • DocumentOrFolderItem: Union type for navigation

Agenda

  • SmartschoolLessons, SmartschoolHours, SmartschoolMomentInfos: Schedule access

Error Handling

from smartschool.exceptions import (
    SmartSchoolException,
    SmartSchoolAuthenticationError, 
)

try:
    session = Smartschool(PathCredentials())
except SmartSchoolAuthenticationError:
    print("Login failed - check credentials")
except SmartSchoolException as e:
    print(f"API error: {e}")

Development

git clone https://github.com/svaningelgem/smartschool.git
cd smartschool
mamba create -n smartschool python=3.11
mamba activate smartschool
pip install poetry
poetry install

Run tests:

poetry run pytest

License

GNU GPLv3

Contributing

Contributions welcome! Please ensure tests pass and follow the existing code style.

Project details


Download files

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

Source Distribution

smartschool-0.6.0.tar.gz (42.8 kB view details)

Uploaded Source

Built Distribution

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

smartschool-0.6.0-py3-none-any.whl (50.2 kB view details)

Uploaded Python 3

File details

Details for the file smartschool-0.6.0.tar.gz.

File metadata

  • Download URL: smartschool-0.6.0.tar.gz
  • Upload date:
  • Size: 42.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for smartschool-0.6.0.tar.gz
Algorithm Hash digest
SHA256 03f082d78a5f4bf2dcca0de1009723ded1f825c7d8935017826f072c48e3a8f6
MD5 efa7d97f34b2730e216f55d59dd648d4
BLAKE2b-256 be053154fe67126db6b912aebd92a0ee714c2c4aa48590d5084918608eeccbea

See more details on using hashes here.

Provenance

The following attestation bundles were made for smartschool-0.6.0.tar.gz:

Publisher: release.yml on svaningelgem/smartschool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smartschool-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: smartschool-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 50.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for smartschool-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c02673584e8ca10088258112171d7f120721cf73a8a34418e110bd1ccba5d5b
MD5 7a860f93437580073991319f0fc9860d
BLAKE2b-256 c5e66d3c703c6845d7bc93fdb098a52cfd9c4e0fb690cb2e08e00584d4ce0b6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for smartschool-0.6.0-py3-none-any.whl:

Publisher: release.yml on svaningelgem/smartschool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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