Skip to main content

API Wrapper for VVS (Verkehrsverbund Stuttgart)

Project description

🚂 VVS API Wrapper

PackageVersion PythonVersions License

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
from vvspy.enums.stations 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
  • Get complete trip info between two stations (including interchanges):
from vvspy import get_trip  # also usable: get_trips
from vvspy.enums.stations 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: 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
from vvspy.enums.stations 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}")

Get your station id

See: #64

Logging

vvspy uses the python logging module. If you want to change the log level of vvsp, 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:

🏆 A win-win cooperation

And now, I invite you to participate in this project! Let's work together to create the most useful tool for all PietSmiet Enjoyers.

  • Issues: ask questions and submit your features.
  • Pull requests: send your improvements to the current.
  • Mail: send your ideas for the project.
  • Discord: add me as a friend on Discord: @zaanposni

Together, we can make this project better every day!

👀 Projects using vvspy

🔥 Other projects of the authors

  • discord-masz - MASZ is a selfhostable highly sophisticated moderation bot for Discord. Includes a web dashboard and a discord bot.

⚠️ License

vvspy is free and open-source software licensed under the 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-2.0.0b1.tar.gz (252.8 kB view details)

Uploaded Source

Built Distribution

vvspy-2.0.0b1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file vvspy-2.0.0b1.tar.gz.

File metadata

  • Download URL: vvspy-2.0.0b1.tar.gz
  • Upload date:
  • Size: 252.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for vvspy-2.0.0b1.tar.gz
Algorithm Hash digest
SHA256 30ab3dfc2fafd1598658bba08d1c30650e24836e55b39a486404d864818311da
MD5 c684ee169bf5f373aa0644ef84110d1d
BLAKE2b-256 ed77145ad40e2cb366ab3ffe4106e5ed59a65b749debc77ef2197bef11af225d

See more details on using hashes here.

File details

Details for the file vvspy-2.0.0b1-py3-none-any.whl.

File metadata

  • Download URL: vvspy-2.0.0b1-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for vvspy-2.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 f0064f3ca32bb7c430d936e39e1b9f0d05f3e073cbae8c27e0c174de6558bb31
MD5 979934753e43c95de22071e32574a4a0
BLAKE2b-256 d913fffe0327d8c41ca56522a3d4011fb986fc23f3366fb3cb6d21eb2d7f8680

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