Skip to content

Latest commit

 

History

History
86 lines (57 loc) · 1.88 KB

README.rst

File metadata and controls

86 lines (57 loc) · 1.88 KB

jim

Linux Built Status Windows Built Status Code coverage

The German railways system at your fingertips.

Install

pip3 install jim

Quick Start

To get all currently running trains:

>>> from jim import RailGrid
>>> bahn = RailGrid()
>>> bahn
<2195 trains>

You can filter for specific trains:

>>> regs = bahn.filter(regional=True)
>>> nats = bahn.filter(national=True)
>>> ices = bahn.filter('ICE')

Let's pick an ICE:

>>> an_ice = ices[-1]
>>> an_ice
<ICE 1086 to Berlin Südkreuz>

Each train is a Train class. You can retrieve its next station like:

>>> an_ice.next_station
<20:26 -> Hamburg Dammtor [+0]>

Similarly goes the previous station:

>>> an_ice.previous_station
<20:24 -> Berlin-Spandau>

If delay data is available, it will be stored here:

>>> an_ice.delay
0

Note

Be aware many trains have a delay setting of None. Then, no data is available. Further, the delay of the next station next_station.delay is distinct from the general delay (as shown before).

Advanced

You can refresh a jim.RailGrid class:

>>> bahn.refresh()
>>> bahn
<2260 trains>

Credits