libtrans/test.py

12 lines
468 B
Python
Raw Normal View History

2024-05-08 10:06:17 +02:00
import src.services.TriMet
from ansiconverter import RGBtoANSI, bold
api = src.services.TriMet.TriMetAPI(api_key="00BA96108889B7ED8850997D7")
result=src.services.TriMet.get_vehicles(api)
for vm in result['vehicles']:
print(RGBtoANSI(
2024-05-11 23:16:30 +02:00
text=f"this is {bold(vm.type[1])} #{bold(vm.id)}.\n\troute #{bold(vm.import_data['routeNumber'])}, next stop: {bold(vm.sign[0])}\n\tboard: {bold(vm.sign[1])}\n\tJSON: {bold(vm.import_data)}",
2024-05-08 10:06:17 +02:00
foregound=vm.route_color
))