Skip to main 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

Project description

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

Credits

deutsche_bahn_api

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

train_delay-1.0.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

train_delay-1.0.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file train_delay-1.0.0.tar.gz.

File metadata

  • Download URL: train_delay-1.0.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.6

File hashes

Hashes for train_delay-1.0.0.tar.gz
Algorithm Hash digest
SHA256 35c77851053c6d98652e75a69dde798829c5b4a6558ec5ed55883f7d84b1b1f8
MD5 d85fd806f8e214a1113b4846ed3166ce
BLAKE2b-256 5fdd207c520f28a43fa09cebfcd9378a35fa25254db13baff1de1c3773d5359d

See more details on using hashes here.

File details

Details for the file train_delay-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: train_delay-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.6

File hashes

Hashes for train_delay-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea83c0be6c0163378298eedcdbd8fe0db01888061de69b6ee0697287b22e0393
MD5 584bab1e5aea299756ed78a8171040dc
BLAKE2b-256 b5e677149def7a2eca4656c938956d11eef30905fe3a646d2459075c8d567896

See more details on using hashes here.

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