🚆 schiene is a Python library for interacting with Bahn.de
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
schiene Fix detail page being collaped when on same network Feb 14, 2018
.gitignore Initial commit Aug 14, 2015
LICENSE.md Update and rename LICENSE to LICENSE.md Nov 21, 2017
README.md Update README.md May 22, 2018
requirements.in update install_requires Jun 3, 2016
requirements.txt update install_requires Jun 3, 2016
setup.cfg initial code Aug 14, 2015
setup.py version: bump version to 0.22 Feb 16, 2018


🚆 schiene

schiene is a Python library for interacting with Bahn.de. Consider it a unofficial API client. This library uses realtime, live information retrieved from Bahn.de and therefore contains information on delays, cancellations etc.

Note: if you do not need live information (delays etc.) you can use the new official Fahrplan API from Deutsche Bahn. Also, the Bahn.de HTML code is a steaming pile of shit that can cause this library to break at any time. Do not use for any critical stuff.


schiene was built during a Hackday event at PhraseApp


pip install schiene

Usage examples

>>> import schiene
>>> s = schiene.Schiene()
>>> s.connections('Mannheim HbF', 'Stuttgart HbF')
[{'arrival': '13:08',
  'canceled': True,
  'delay' : {
    'delay_departure' : 15,
    'delay_arrival': 0
  'departure': '12:30',
  'details': 'http://mobile.bahn.de/bin/mobil/query.exe/dox?ld=15085&n=1&i=or.0179785.1439546366&rt=1&use_realtime_filter=1&co=C0-1&vca&HWAI=CONNECTION$C0-1!details=opened!&',
  'price': 39.0,
  'products': ['ICE'],
  'time': '0:38',
  'transfers': 0},
 {'arrival': '13:54',
  'departure': '12:38',
  'details': 'http://mobile.bahn.de/bin/mobil/query.exe/dox?ld=15085&n=1&i=or.0179785.1439546366&rt=1&use_realtime_filter=1&co=C0-2&vca&HWAI=CONNECTION$C0-2!details=opened!&',
  'ontime': True,
  'price': 30.0,
  'products': ['S', 'EC'],
  'time': '1:16',
  'transfers': 1},
>>> s.stations('Hamburg')
[{'extId': '008002549',
  'id': 'A=1@O=Hamburg '
  'prodClass': '15',
  'state': 'id',
  'type': '1',
  'typeStr': '[Bhf/Hst]',
  'value': 'Hamburg Hbf',
  'weight': '24258',
  'xcoord': '10006908',
  'ycoord': '53552732'},
 {'extId': '008002548',
  'id': 'A=1@O=Hamburg '
  'prodClass': '31',
  'state': 'id',
  'type': '1',
  'typeStr': '[Bhf/Hst]',
  'value': 'Hamburg Dammtor',
  'weight': '27663',
  'xcoord': '9989568',
  'ycoord': '53560751'},

Projects using schiene

Create a pull request to add your project here