Hello mtadevelopers,
I am looking for help on parsing the incoming protobuff data from the MTA API
I have compiled the necessary proto files to utilize with my python scripts
But when trying to read the protobuff data I get the error:
google.protobuff.message.DecodeError: Error Parsing Message
Files are attached below
Here is my directory structure
mta/
- gtfs-realtime.proto
- nyct.proto
- gtfs_realtime_pb2.py
- nyct_pb2.py
- nyc.proto
- data-reader.py
- data-receiver.py
- out.bin
data-receiver.py
data-reader.py
import nyct_pb2
import gtfs_realtime_pb2
with open('out.bin', 'rb') as f:
read_nyct = nyct_pb2.NyctTripDescriptor()
read_nyct.ParseFromString(f.read())
print(read_nyct)
Thank you for your help.