Skip to content

cgtobi/PyRMVtransport

Repository files navigation

PyRMVtransport 🚌

Python library to make use of transport information from opendata.rmv.de.

GitHub Actions PyPi

PyPi codecov Maintainability Downloads

Installation

$ pip install PyRMVtransport

Usage

import asyncio
import aiohttp
from RMVtransport import RMVtransport

async def main():
    """The main part of the example script."""
    async with aiohttp.ClientSession():
        rmv = RMVtransport()

        # Get the data
        try:
            # Departures for station 3006907 (Wiesbaden Hauptbahnhof)
            # max. 5 results
            # only specified products (S-Bahn, U-Bahn, Tram)
            data = await rmv.get_departures(
                station_id="3006907", products=["S", "U-Bahn", "Tram"], max_journeys=5
            )

            # Use the JSON output
            print(data)

            # or pretty print
            rmv.print()
        except TypeError:
            pass

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

About

🚌 Get transport information from opendata.rmv.de

Resources

License

Stars

Watchers

Forks

Packages

No packages published