Skip to main content

API Wrapper for VVS (Verkehrsverbund Stuttgart)

Project description

VVS API Wrapper

Checkup status Checkup status

Fully object-oriented library to integrate the VVS API into your project.

Installation

Python 3.6 or higher required

pip install vvspy

Examples

  • Detect delay in upcoming departures:
from vvspy import get_departures

deps = get_departures("5006115", limit=3)  # Stuttgart main station
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
  • Get complete trip info between two stations (including interchanges):
from vvspy import get_trip  # also usable: get_trips

trip = get_trip("5000355", "5005600")  # Stuttgart main station

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: Wallgraben - To: Hauptbf (A.-Klett-Pl.)
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

deps = get_departures("5006118")  # Stuttgart main station (lower)
for dep in deps:
    if dep.serving_line.symbol == "S4":
        print(f"Departure of S4 at {dep.real_datetime}")

Get your station id

See: https://github.com/FI18-Trainees/vvspy/issues/12#issuecomment-568175314

Features

  • full customizable requests and parameters

  • parsing all available info into result obj

  • Well tested and maintained

  • Departures, Arrivals, Trips, Station info, Upcoming events, Maintenance work

  • See issues/projects on GitHub for upcoming features

Contributors

Projects using vvspy

License:

This project is licensed under MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vvspy-1.1.4.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

vvspy-1.1.4-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file vvspy-1.1.4.tar.gz.

File metadata

  • Download URL: vvspy-1.1.4.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for vvspy-1.1.4.tar.gz
Algorithm Hash digest
SHA256 1e3d04547a4d08c4b155065c22c64c9897fc108933ac79999f5bd59c92af7f15
MD5 b1785d4e27bd6e752a5f774dc35f8feb
BLAKE2b-256 6eef7ef9961adf132dc267c3a6c6bcce403d97750389e87da61c40882bfe7981

See more details on using hashes here.

File details

Details for the file vvspy-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: vvspy-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for vvspy-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7d99d182260f05e5975254e859925be06286c198b6cd8e55bbba23d3db1ceb81
MD5 4a9118811daab3fe1522e7321cd0de0a
BLAKE2b-256 48ae625111c0d5831071a295b4db7f490b472fb8983dc7b17a54415ee4be664e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page