Skip to main content

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

Metadata

Release files for train-delay 1.0.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 train-delay 1.0.0
File Size Uploaded Provenance Actions
train_delay-1.0.0.tar.gz 18.0 kB Without provenance Details for train_delay-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for train-delay 1.0.0
File Interpreter ABI Platform Actions
train_delay-1.0.0-py3-none-any.whl Python 3 none any Details for train_delay-1.0.0-py3-none-any.whl

Total release size: 36.1 kB

Release files / train_delay-1.0.0.tar.gz

Download URL train_delay-1.0.0.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
35c77851053c6d98652e75a69dde798829c5b4a6558ec5ed55883f7d84b1b1f8
BLAKE2b-256 checksum
How to use checksums
5fdd207c520f28a43fa09cebfcd9378a35fa25254db13baff1de1c3773d5359d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.6

Release files / train_delay-1.0.0-py3-none-any.whl

Download URL train_delay-1.0.0-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea83c0be6c0163378298eedcdbd8fe0db01888061de69b6ee0697287b22e0393
BLAKE2b-256 checksum
How to use checksums
b5e677149def7a2eca4656c938956d11eef30905fe3a646d2459075c8d567896
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.6

Security for train-delay 1.0.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.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