Skip to main content

🚂 VVS API Wrapper

PackageVersion PythonVersions License

Fully object-oriented library to integrate the VVS API into your project. vvspy ships with type hints, so editors and type checkers understand its API.

Installation

pip install vvspy

Examples

  • Detect delay in upcoming departures:
from vvspy import get_departures
from vvspy.enums import Station

deps = get_departures(Station.HAUPTBAHNHOF__TIEF, limit=3)
for dep in deps:
    if dep.delay > 0:
        print("Alarm! Delay detected.")
        print(dep)  # [Delayed] [11:47] [RB17]: Stuttgart Hauptbahnhof (oben) - Pforzheim Hauptbahnhof

    else:
        print("Train on time")
        print(dep)  # [11:47] [RB17]: Stuttgart Hauptbahnhof (oben) - Pforzheim Hauptbahnhof
  • Detect cancellations in upcoming departures/arrivals:
from vvspy import get_departures
from vvspy.enums import Station

deps = get_departures(Station.VAIHINGEN, limit=5)

for dep in deps:
    if dep.cancelled:
        print(f"Alarm! The train at {dep.real_datetime} has been cancelled!")
        # Check dep.stop_infos and dep.line_infos for more information
  • Get complete trip info between two stations (including interchanges):
from vvspy import get_trip  # also usable: get_trips
from vvspy.enums import Station

trip = get_trip(Station.HAUPTBAHNHOF__TIEF, Station.HARDTLINDE)

print(f"Duration: {trip.duration / 60} minutes")
for connection in trip.connections:
    print(f"From: {connection.origin.name} - To: {connection.destination.name}")
# Output:
Duration: 58 minutes
From: Hauptbf (Arnulf-Klett-Platz) - To: Stuttgart Hauptbahnhof (tief)
From: Stuttgart Hauptbahnhof (tief) - To: Marbach (N)
From: Marbach (N) Bf - To: Murr Hardtlinde
  • Filter for specific lines:
from vvspy import get_departures
from vvspy.enums import Station

deps = get_departures(Station.HAUPTBAHNHOF__TIEF)
for dep in deps:
    if dep.serving_line.symbol == "S4":
        print(f"Departure of S4 at {dep.real_datetime}")
  • Filter for specific platforms:
from vvspy import get_departures
from vvspy.enums import Station

deps = get_departures(Station.HAUPTBAHNHOF__TIEF)
for dep in deps:
    if dep.platform == "101":
        print(f"Departure of {dep.serving_line.number} to {dep.serving_line.direction} on {dep.platform_name} at {dep.real_datetime}")
  • Get trips arriving by a specific time:
from datetime import datetime, timedelta
from vvspy import get_trip
from vvspy.enums import Station

tomorrow_8am = (datetime.now() + timedelta(days=1)).replace(hour=8, minute=0)

trip = get_trip(
    Station.HAUPTBAHNHOF__TIEF,
    Station.HARDTLINDE,
    check_time=tomorrow_8am,
    itdDateTimeDepArr="arr",
    itdTripDateTimeDepArr="arr",
)

Get your station id

Use get_stops to search for a stop by name. Both stop.stop_id and stop.global_id can be used as station id in all other functions. global_id uses the same format as the Station enum:

from vvspy import get_stops

stops = get_stops("Hauptbahnhof Stuttgart")
print(stops[0])
print(stops[0].global_id)
# Output:
Stuttgart, Hauptbahnhof (de:08111:6118)
de:08111:6118

See also: #64

Logging

vvspy uses the python logging module. If you want to change the log level of vvspy, use the following:

import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("vvspy")
logger.setLevel(logging.DEBUG)

⭐️ Project assistance

If you want to say thank you or/and support active development of vvspy:

Please report security vulnerabilities privately as described in SECURITY.md.

👀 Projects using vvspy

⚠️ License

vvspy is free and open-source software licensed under the MIT.

The Station enum is generated from the "Haltestellen VVS" dataset by VVS, published on opendata-oepnv.de under a Creative Commons Attribution (CC BY) license.

Metadata

Release files for vvspy 2.4.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 vvspy 2.4.0
File Size Uploaded Provenance Actions
vvspy-2.4.0.tar.gz 286.5 kB With provenance Details for vvspy-2.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vvspy 2.4.0
File Interpreter ABI Platform Actions
vvspy-2.4.0-py3-none-any.whl Python 3 none any Details for vvspy-2.4.0-py3-none-any.whl

Total release size: 583.1 kB

Release files / vvspy-2.4.0.tar.gz

Download URL vvspy-2.4.0.tar.gz
Size 286.5 kB
Tags Source
SHA-256 checksum
How to use checksums
218dc85c43327c9a717e9efee55779c3853960b5f623947f6ab48be586b46d92
BLAKE2b-256 checksum
How to use checksums
dbe8feb4d29014a290164323a825454d6d5a8ba8475334d4a4d5c9d3db50467a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / vvspy-2.4.0-py3-none-any.whl

Download URL vvspy-2.4.0-py3-none-any.whl
Size 296.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ceff9a39bceb800ca568e2ba7ca1c2ce8332497d6b469e3bbe50d043fd50da4f
BLAKE2b-256 checksum
How to use checksums
096d1a7c828bfb92c91998d93813230b095e59ed50ba48780e133b269bfe8de1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Security for vvspy 2.4.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vvspy-2.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

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.

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