Skip to content

TrainDelay is a Python package for tracking train delays at various stations using the Deutsche Bahn API. It collects real-time train data, processes delay information, and stores it in a MySQL database for further analysis.

License

Notifications You must be signed in to change notification settings

MichaelMrt/TrainDelay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TrainDelay

TrainDelay is a Python package for tracking train delays at various stations using the Deutsche Bahn API. It collects real-time train data, processes delay information, and stores it in a MySQL database for further analysis.

Features

  • Fetches train timetable and delay data for specified stations
  • Stores train data in a MySQL database
  • Logs tracking operations and errors

Requirements

  1. Get a MySQL Server running on your machine, the database and tables will be created my the module
  2. Register for the Deutsche Bahn API (free)

Setup

  1. Install train_delay using: pip install train_delay
  2. import module
from train_delay import *
  1. Create an AuthData object and a DatabaseConfig object
auth_data = AuthData(YOUR_CLIENT_ID, YOUR_CLIENT_SECRET)  
database_config = DatabaseConfig(YOUR_DB_HOSTNAME, YOUR_DB_USER, YOUR_DB_PASSWORD, YOUR_DATABASE_NAME)

You can choose the YOUR_DATABASE_NAME freely. The module will create the database and necessary table where all trains will be stored.

  1. Now you can create a TrainDelayTracker object
train_delay_tracker = TrainDelayTracker(auth_data, database_config)
  1. Track your desired train stations with the track_station() Method
train_delay_tracker.track_station("Bonn")
  1. You'll find your trains at YOUR_DATABASE_NAME.trains alt text

Upcoming Features

  • API to easily analyse the stored data
  • Web-UI to visualize and interact with the stored train delay data
  • SQLite support
  • Docker Container which immediatly tracks data after startup

Credits

https://github.com/Tutorialwork/deutsche_bahn_api

About

TrainDelay is a Python package for tracking train delays at various stations using the Deutsche Bahn API. It collects real-time train data, processes delay information, and stores it in a MySQL database for further analysis.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages