Metro-Transit-LED/test.py

11 lines
350 B
Python

from google.transit import gtfs_realtime_pb2
import requests
from protobuf_to_dict import protobuf_to_dict
feed = gtfs_realtime_pb2.FeedMessage()
response = requests.get(
'https://svc.metrotransit.org/mtgtfs/vehiclepositions.pb', allow_redirects=True)
feed.ParseFromString(response.content)
zet_dict = protobuf_to_dict(feed)
print(zet_dict)