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.7.0.tar.gz (43.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.7.0-py3-none-any.whl (52.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartschool-0.7.0.tar.gz
  • Upload date:
  • Size: 43.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.7.0.tar.gz
Algorithm Hash digest
SHA256 e8b61eff2f06a62c5323b2197ff3d689b9bad1ab2d7b81ed1e0dece3bab0ceba
MD5 f01c4f02dd9b5a0854ab50c31ffd5a5a
BLAKE2b-256 40831c40ecd1d06b26991aef2a10ebfa7b33b93eee2e3e60dcb831794a73192a

See more details on using hashes here.

Provenance

The following attestation bundles were made for smartschool-0.7.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.7.0-py3-none-any.whl.

File metadata

  • Download URL: smartschool-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 52.9 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.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6efdffdb4b14a1de106cc5798e54d0a46b615ab4aabb0ee8a95e6fc842cc2f81
MD5 64ae437f2295a6ca049ac81c1d887d4e
BLAKE2b-256 e4d788b318d4b504b9d4069839056b803cb486704bf7c6263395a89d9868760f

See more details on using hashes here.

Provenance

The following attestation bundles were made for smartschool-0.7.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