Simple reference implementation for VDV 736 subscriber and publisher written in Python
Project description
PyVDV736
Simple reference implementation for VDV736 subscriber and publisher written in Python. VDV736 is a data standard based on SIRI-SX for public transport situation exchange.
Situation Exchange in VDV736
Exchanging public transport situations works with a realtime capable setup using a publish/subscribe mechanism. To get this working, the publisher (in most cases called 'server') as well as the subscriber (in most cases called 'client') needs to be callable via an HTTP(S) interface.
A subscription then works as follows:
- The subscriber registers at the publisher with its participant ID (aka 'Leitstellenkennung') and some basic subscription parameters
- The publisher stores this subscription and every time a new public transport situation is published, the publisher calls the subscriber's endpoint with a body containing data
- At the end, the subscribers terminates his subscription sending a request to the publisher again, stating that the existing subscription should be deleted
This way, data are only transferred, when they're updated in realtime without polling. Other well-known public transport protocols (like VDV453, VDV454, SIRI) work exactly the same. A digital data hub (aka 'Datendrehscheibe') combines the role of the publisher and subscriber.
Note: SIRI-SX offers also the option for fetching public transport situations using a simple GET request. VDV736 states that only publish/subscribe is supported. Hence, the request endpoint of the publisher is only experimental and not supported officially.
Configuration
There's a YAML file which contains basic configuration for all participants (subscriber as well as publisher). See following example for reference:
PY_TEST_PUBLISHER:
host: "127.0.0.1"
port: 9091
protocol: http
status_endpoint: /status
subscribe_endpoint: /subscribe
unsubscribe_endpoint: /unsubscribe
request_endpoint: /request
delivery_endpoint: null
The top level keys are the participant IDs, which must be agreed between the participants at first. Each participant system needs to have an IP address or hostname, a port and a protocol which should be used for access. You can also specify the endpoints for the different actions a participant is providing.
Installation & Usage
Using this library is quite simple. Install it using
pip install pyvdv736
Then use a Subscriber or Publisher object to work with. See following example:
from vdv736.subscriber import Subscriber
with Subscriber('PY_TEST_SUBSCRIBER', './participants.yaml') as subscriber:
subscription_id = subscriber.subscribe('PY_TEST_PUBLISHER')
...
subscriber.unsubscribe(subscription_id)
while True:
pass
See sample scripts in the demo folder.
License
This project is licensed under the Apache License. See LICENSE.md for more information.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyvdv736-0.0.6.tar.gz.
File metadata
- Download URL: pyvdv736-0.0.6.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7876d3823a2369081509e1a6420f3ab3c7f4fb5986a2ba35e83efd4bf95a2d6e
|
|
| MD5 |
bc4d1f1656fedb27d61554679f8aa117
|
|
| BLAKE2b-256 |
c1f1979da374ac60485fc0622e8443f04f0d53c2ca08fe71ecfe5f689a7c4d58
|
Provenance
The following attestation bundles were made for pyvdv736-0.0.6.tar.gz:
Publisher:
pypi-build-push-latest.yaml on sebastianknopf/pyvdv736
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvdv736-0.0.6.tar.gz -
Subject digest:
7876d3823a2369081509e1a6420f3ab3c7f4fb5986a2ba35e83efd4bf95a2d6e - Sigstore transparency entry: 173622038
- Sigstore integration time:
-
Permalink:
sebastianknopf/pyvdv736@73c232588846ceb266e54b5a89c75e8b2b6c0028 -
Branch / Tag:
refs/tags/0.0.6 - Owner: https://github.com/sebastianknopf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-build-push-latest.yaml@73c232588846ceb266e54b5a89c75e8b2b6c0028 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyvdv736-0.0.6-py3-none-any.whl.
File metadata
- Download URL: pyvdv736-0.0.6-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e1132eb822ea66885e136487cb6701ffdf587196a9776c19dd550a011de63a6
|
|
| MD5 |
e0171fbde62931c868056b4a06b6edfc
|
|
| BLAKE2b-256 |
502df93aea7ba7383ffc828cb210f5332dfe13acd9ea4f0eedd666149966cc63
|
Provenance
The following attestation bundles were made for pyvdv736-0.0.6-py3-none-any.whl:
Publisher:
pypi-build-push-latest.yaml on sebastianknopf/pyvdv736
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvdv736-0.0.6-py3-none-any.whl -
Subject digest:
6e1132eb822ea66885e136487cb6701ffdf587196a9776c19dd550a011de63a6 - Sigstore transparency entry: 173622039
- Sigstore integration time:
-
Permalink:
sebastianknopf/pyvdv736@73c232588846ceb266e54b5a89c75e8b2b6c0028 -
Branch / Tag:
refs/tags/0.0.6 - Owner: https://github.com/sebastianknopf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-build-push-latest.yaml@73c232588846ceb266e54b5a89c75e8b2b6c0028 -
Trigger Event:
push
-
Statement type: