from google.transit import gtfs_realtime_pb2 import requests feed = gtfs_realtime_pb2.FeedMessage() # response = requests.get('https://www.ztm.poznan.pl/pl/dla-deweloperow/getGtfsRtFile?file=trip_updates.pb') # response = '' # with open('trip_updates.pb', 'rb') as f: # response = f.read() # feed.ParseFromString(response) # for entity in feed.entity: # print(entity) # if entity.HasField('trip_update'): # print(entity.trip_update) with open('feeds.pb', 'rb') as f: response = f.read() feed = gtfs_realtime_pb2.FeedMessage() feed.ParseFromString(response) for entity in feed.entity: print(entity) # if entity.HasField('trip_update'): # print(entity.trip_update)