Python wrapper for the RRTA (MyStop) REST API.
Project description
python-rrta
Python wrapper for the RRTA (MyStop) REST API.
Usage
import aiohttp
import asyncio
from rrta import RRTAClient
async def main():
session = aiohttp.ClientSession()
client = RRTAClient(session=session)
routes = await client.get_all_routes()
for route in routes:
vehicles = await client.get_vehicles(route_ids=[route.RouteId])
print(f"Route {route.RouteId}: {len(vehicles)} Vehicles")
for v in vehicles:
print(f"\t{v.VehicleId} currently en-route to {v.Destination} at {v.Speed} MPH")
if __name__ == "__main__":
asyncio.run(main())
Installation
pip install rrta
Known Issues
- Dataclasses are not pythonic at the moment and contain a bunch of member variables that RRTA doesn't seem to use despite being part of the MyStop spec
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
rrta-0.1.tar.gz
(7.5 kB
view hashes)
Built Distribution
rrta-0.1-py3-none-any.whl
(10.4 kB
view hashes)