Unofficial API interface to the smartschool system.
Project description
Smartschool Parser
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 browsersmartschool_download_all_documents: Bulk download all course documentssmartschool_report_on_*: Email notification scripts for tasks and results
API Reference
Core Classes
Smartschool: Main session handlerPathCredentials,EnvCredentials,AppCredentials: Authentication methods
Data Access
Courses,TopNavCourses: Course informationResults,ResultDetail: Grade managementMessageHeaders,Message,Attachments: CommunicationFutureTasks,PlannedElements: Task schedulingPeriods: Academic termsStudentSupportLinks: Support resources
File Management
FileItem,FolderItem,InternetShortcut: Document typesDocumentOrFolderItem: 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8b61eff2f06a62c5323b2197ff3d689b9bad1ab2d7b81ed1e0dece3bab0ceba
|
|
| MD5 |
f01c4f02dd9b5a0854ab50c31ffd5a5a
|
|
| BLAKE2b-256 |
40831c40ecd1d06b26991aef2a10ebfa7b33b93eee2e3e60dcb831794a73192a
|
Provenance
The following attestation bundles were made for smartschool-0.7.0.tar.gz:
Publisher:
release.yml on svaningelgem/smartschool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smartschool-0.7.0.tar.gz -
Subject digest:
e8b61eff2f06a62c5323b2197ff3d689b9bad1ab2d7b81ed1e0dece3bab0ceba - Sigstore transparency entry: 254337457
- Sigstore integration time:
-
Permalink:
svaningelgem/smartschool@adba9521d1915f26fdf5485dd513ad66a46fcadd -
Branch / Tag:
refs/tags/0.7.0 - Owner: https://github.com/svaningelgem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@adba9521d1915f26fdf5485dd513ad66a46fcadd -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6efdffdb4b14a1de106cc5798e54d0a46b615ab4aabb0ee8a95e6fc842cc2f81
|
|
| MD5 |
64ae437f2295a6ca049ac81c1d887d4e
|
|
| BLAKE2b-256 |
e4d788b318d4b504b9d4069839056b803cb486704bf7c6263395a89d9868760f
|
Provenance
The following attestation bundles were made for smartschool-0.7.0-py3-none-any.whl:
Publisher:
release.yml on svaningelgem/smartschool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smartschool-0.7.0-py3-none-any.whl -
Subject digest:
6efdffdb4b14a1de106cc5798e54d0a46b615ab4aabb0ee8a95e6fc842cc2f81 - Sigstore transparency entry: 254337458
- Sigstore integration time:
-
Permalink:
svaningelgem/smartschool@adba9521d1915f26fdf5485dd513ad66a46fcadd -
Branch / Tag:
refs/tags/0.7.0 - Owner: https://github.com/svaningelgem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@adba9521d1915f26fdf5485dd513ad66a46fcadd -
Trigger Event:
push
-
Statement type: