17 lines
349 B
Python
17 lines
349 B
Python
from socket import MsgFlag
|
|
import protoparser
|
|
import json
|
|
|
|
def parseMessage(pb, parent):
|
|
if hasattr(pb, 'messages'):
|
|
for msg in pb.messages:
|
|
print(pb.messages)
|
|
|
|
|
|
|
|
pb = protoparser.parse_from_file("pb/messages.proto")
|
|
#print(json.dumps(pb))
|
|
print(json.dumps(pb.messages))
|
|
|
|
with open('messages.json', 'w') as f:
|
|
f.write(pb) |