Skip to content

helldog136/pystibmvib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pystibmvib GitHub version Build Status PyPI version Buy me a beer!

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 (see: https://github.com/helldog136/stib-mvib-sensor )

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 asyncio

import aiohttp

from pystibmvib import STIBAPIClient
from pystibmvib.service.STIBService import STIBService

CLIENT_ID = '' # Put your openapi client ID here
CLIENT_SECRET = '' # Put your openapi client secret here


async def go(LOOP):
    stop_name = "scherdemael"
    lines_filter = [(46, "Glibert")]
    custom_session = aiohttp.ClientSession()

    APIClient = STIBAPIClient(LOOP, custom_session, CLIENT_ID, CLIENT_SECRET)

    service = STIBService(APIClient)
    print(await service.get_passages(stop_name, lines_filter))

    await custom_session.close()


if __name__ == '__main__':
    LOOP = asyncio.get_event_loop()
    LOOP.run_until_complete(go(LOOP))

About

OUTDATED: SEE https://github.com/helldog136/pystibmivb An open source Python package to retrieve realtime data of passages at stops of STIB/MVIB, the public transport company in Brussels (Belgium)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%