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
- Get a MySQL Server running on your machine, the database and tables will be created my the module
- Register for the Deutsche Bahn API (free)
- Create a account at: https://developers.deutschebahn.com
- Create a new application using this url: https://developers.deutschebahn.com/db-api-marketplace/apis/application/new and choose a name that you want
- After that save you the client id and the client secret. You need it to interact with the api
- Navigate to all available apis page at: https://developers.deutschebahn.com/db-api-marketplace/apis/product and select the "Timetables" api
- And click the red subscribe button and select your application
- Now you are done and can start using the api
Setup
- Install train_delay using:
pip install train_delay - import module
from train_delay import *
- 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.
- Now you can create a TrainDelayTracker object
train_delay_tracker = TrainDelayTracker(auth_data, database_config)
- Track your desired train stations with the track_station() Method
train_delay_tracker.track_station("Bonn")
- You'll find your trains at YOUR_DATABASE_NAME.trains
Credits
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)
| 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)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| 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.