Get realtime info on stop passages of STIB/MIVB (opendata-api.stib-mivb.be)
Project description
pystibmivb
A Python package to retrieve realtime data of passages at stops of STIB/MIVB, the public transport company of Brussels (Belgium)
Main purpose at the moment is to feed a sensor in Home-Assistant (see: https://github.com/Emilv2/home-assistant/tree/stib-mivb/homeassistant/components/stib_mivb )
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 pystibmivb
Example usage
"""Example usage of pystibmivb."""
import asyncio
import aiohttp
from pystibmivb import STIBAPIClient
from pystibmivb.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")]
# lines_filter = [(46, 1)] # you can also give dirction instead of terminus
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))
Old repository: https://github.com/helldog136/pystibmvib Initial inspiration came from : https://github.com/bollewolle/pydelijn
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
File details
Details for the file pystibmivb-1.4.2.tar.gz
.
File metadata
- Download URL: pystibmivb-1.4.2.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d488c29ee67c7ff866db5d3f89fa573e8f0987b065310245e508bccd3887c532 |
|
MD5 | bca400f62e313c2ac4f7e055913f3aba |
|
BLAKE2b-256 | 4cf6e68cd49cd2f60fb0e5cff778acb97aaa723614110cd4948a123105a032d6 |