Skip to main content

Get realtime info on stop passages of STIB/MVIB (opendata-api.stib-mivb.be)

Project description

pystibmvib GitHub version Build Status PyPI version

A Python package to retrieve realtime data of passages at stops of STIB/MVIB, the public transport company of Brussels (Belgium)

Main purpose at the moment is to feed a sensor in Home-Assistant

Important note: a developer account needs to be created at https://opendata.stib-mivb.be/ to generate a subscription key for the api's.

Install

pip install pystibmvib

Example usage

"""Example usage of pystibmvib."""
import aiohttp 

from pystibmvib import Passages


async def test_shapefile_reader():
    """Example usage of pystibmvib."""
    client_id = '<put your opendata.stib-mivb.be client id here>'
    client_secret = '<put your opendata.stib-mivb.be client secret here>'


    stop_name = "scherdemael"
    filtered_out_stop_ids = ['3713']
    custom_session = aiohttp.ClientSession()

    r = Passages(LOOP, stop_name, client_id, client_secret, filtered_out_stop_ids=filtered_out_stop_ids, session=custom_session)

    await r.update_passages()
    print(r.passages)

    await custom_session.close()



import asyncio

LOOP = asyncio.get_event_loop()
LOOP.run_until_complete(test_shapefile_reader())
LOOP.close()

Project details


Download files

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

Files for pystibmvib, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size pystibmvib-0.0.3.tar.gz (6.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page