This project implements a simple airline booking management system for KLM in Python. It includes functionalities to add bookings and query them based on departure times and routes.
- Add new flight bookings.
- Retrieve bookings departing before a specified time.
- Retrieve bookings for a specific route (origin to destination).
- Python 3.10 or higher
- Clone the repository
- Navigate to the project directory
- Run the project using Python (there are no third party libraries)
git clone https://github.com/dariomory/klm-booking-system.git
cd klm-booking-system
python main.py
Run the tests using the following command:
python3 -m unittest discover tests
To use the BookingManager, create an instance of the BookingManager class and use its methods to manage bookings.
See also: demo.py
from klm_booking_system import Itinerary
itinerary = Itinerary(["AMS", "LHR", "JFK"])
from klm_booking_system import Booking
from datetime import datetime
booking = Booking(datetime(2023, 5, 26, 6, 45), itinerary)
from klm_booking_system import BookingManager
manager = BookingManager()
manager.add_booking(booking)
bookings_before_date = manager.bookings_before(datetime(2023, 6, 1))
bookings_on_route = manager.bookings_for_route("AMS", "LHR")