API Wrapper for VVS (Verkehrsverbund Stuttgart)
Project description
VVS API Wrapper
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
- vvs_direct_connect is a dockerized REST service providing departure data by @aschuma.
License:
This project is licensed under MIT.
Project details
Release history Release notifications | RSS feed
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.2.0.tar.gz
(23.4 kB
view details)
Built Distribution
vvspy-1.2.0-py3-none-any.whl
(18.2 kB
view details)
File details
Details for the file vvspy-1.2.0.tar.gz
.
File metadata
- Download URL: vvspy-1.2.0.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4ff6531bb12860daa3592c762e353f159ecf9ab3f5bcc52f5f44ca7865972d4 |
|
MD5 | 9657be77b1f61ca05b5e49a13c77defe |
|
BLAKE2b-256 | 77c8b6796e3693401a32278c9bd72a4f8b39aa6b4c5482106e9c813ada994163 |
File details
Details for the file vvspy-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: vvspy-1.2.0-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea0dab077cab697b3229cd39927bb1902385812747586b556823f08f21b3a67c |
|
MD5 | cab5e9586a3d462dbab4ea7addac6ef1 |
|
BLAKE2b-256 | 1eb9c55814ad38223b63646f891960b4aee7112d91be6ebe3f6c4a01b756bbf1 |