Skip to main content

Bakalapi Python Library

A Python library for accessing the Bakalapi timetable API. This library provides a simple interface to query timetable information by teacher, room, or class.

Installation

Install from local directory

If you have the source code, you can install it directly:

pip install .

Or in development mode (editable install):

pip install -e .

Install from PyPI (if published)

If the package is published to PyPI, you can install it with:

pip install bakalapi

Development Installation

For development, you can also install dependencies separately:

pip install -r requirements.txt

Usage

Basic Usage

from bakalapi import BakalapiClient

# Create a client instance
client = BakalapiClient()

# Get timetable by teacher
timetable = client.get_teacher_timetable("Hana Jaitnerová")
print(f"Found {len(timetable.timetable)} entries")
for entry in timetable.timetable:
    print(f"{entry.date} {entry.time}: {entry.subject} - {entry.class_name}")

# Get timetable by room
timetable = client.get_room_timetable("a1")
print(f"Room a1 has {len(timetable.timetable)} scheduled entries")

# Get timetable by class
timetable = client.get_class_timetable("4.B Sk1")
print(f"Class 4.B Sk1 has {len(timetable.timetable)} scheduled entries")

# Close the client when done
client.close()

Using Context Manager

from bakalapi import BakalapiClient

with BakalapiClient() as client:
    timetable = client.get_teacher_timetable("Mgr. Hana Jaitnerová")
    # Client is automatically closed when exiting the context

Accessing Data

The library provides structured data models:

from bakalapi import BakalapiClient

client = BakalapiClient()
timetable = client.get_teacher_timetable("Mgr. Hana Jaitnerová")

# Access hour definitions
for hour in timetable.hours:
    print(f"Hour {hour.number}: {hour.start_time} - {hour.end_time}")

# Access timetable entries
for entry in timetable.timetable:
    print(f"Day: {entry.day}")
    print(f"Date: {entry.date}")
    print(f"Time: {entry.time}")
    print(f"Subject: {entry.subject}")
    print(f"Teacher: {entry.teacher}")
    print(f"Room: {entry.room}")
    print(f"Class: {entry.class_name}")
    print(f"Theme: {entry.theme}")
    print(f"Change info: {entry.changeinfo}")
    print("---")

Error Handling

from bakalapi import BakalapiClient, BakalapiAPIError

client = BakalapiClient()

try:
    timetable = client.get_teacher_timetable("Non-existent Teacher")
except BakalapiAPIError as e:
    print(f"API Error: {e}")
    print(f"Status Code: {e.status_code}")
except ValueError as e:
    print(f"Invalid parameter: {e}")

API Methods

get_teacher_timetable(teacher_name: str) -> TimetableResponse

Get the timetable for a specific teacher.

Parameters:

  • teacher_name: The name of the teacher (e.g., "Mgr. Hana Jaitnerová")

Returns:

  • TimetableResponse: Object containing hours and timetable entries

get_room_timetable(room_index: str) -> TimetableResponse

Get the timetable for a specific room.

Parameters:

  • room_index: The room index/identifier (e.g., "a1")

Returns:

  • TimetableResponse: Object containing hours and timetable entries

get_class_timetable(class_name: str) -> TimetableResponse

Get the timetable for a specific class.

Parameters:

  • class_name: The name of the class (e.g., "4.B Sk1")

Returns:

  • TimetableResponse: Object containing hours and timetable entries

Data Models

TimetableResponse

  • hours: List[Hour] - List of hour definitions
  • timetable: List[TimetableEntry] - List of timetable entries

Hour

  • number: int - Hour number
  • start_time: str - Start time (e.g., "8:00")
  • end_time: str - End time (e.g., "8:45")

TimetableEntry

  • day: str - Day abbreviation (e.g., "po", "út", "st")
  • date: str - Date (e.g., "12.1.")
  • hour_number: int - Hour number
  • time: str - Time range (e.g., "8:00 - 8:45")
  • subject: str - Subject name
  • teacher: str - Teacher name(s)
  • room: str - Room identifier
  • class_name: str - Class name(s)
  • theme: Optional[str] - Lesson theme/topic
  • notice: Optional[str] - Notice/note
  • changeinfo: Optional[str] - Change information
  • entry_type: str - Entry type (e.g., "atom")

Notes

  • Parameters cannot be combined: You can only query by one type (teacher, room, or class) at a time.
  • The API endpoint is: https://bakalapi-production.up.railway.app/api/timetable/
  • All parameters are automatically URL-encoded for safe transmission.

Publishing to PyPI

If you want to publish this package to PyPI so others can install it with pip install bakalapi:

  1. Install build tools:

    pip install build twine
    
  2. Build the package:

    python -m build
    
  3. Upload to PyPI (test first with TestPyPI):

    # Test upload
    twine upload --repository testpypi dist/*
    
    # Production upload
    twine upload dist/*
    

Note: Update the pyproject.toml file with your actual author information and repository URLs before publishing.

License

This library is provided as-is for accessing the Bakalapi timetable API.

Metadata

Release files for bakalapi 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bakalapi 1.2.0
File Size Uploaded Provenance
bakalapi-1.2.0.tar.gz 6.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bakalapi 1.2.0
File Interpreter ABI Platform
bakalapi-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / bakalapi-1.2.0.tar.gz

Download URL bakalapi-1.2.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7051d16849b3bb34731ff7e208cca3e9075dd6771fe9e998bba843d0fa1caee1
BLAKE2b-256 checksum
How to use checksums
bf136f4452fde251c673f2caa526f56c60b711643f8d3e0152d33ebc2ac9f5f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / bakalapi-1.2.0-py3-none-any.whl

Download URL bakalapi-1.2.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fec70754aff636689502442e2d822238ae038ada0ca5240a9ab4149d40103f8e
BLAKE2b-256 checksum
How to use checksums
6333754e5871990a3878685843fd12054aa00dfd03ff11155de7dd9a3036e8e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for bakalapi 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page