Qfiard's answer did not work for me. The message.DESCRIPTOR.fields.keys() call was created by AttributeError: 'list' object has no attribute 'keys' .
Not sure why this will not work. Perhaps this has something to do with how the message was defined / compiled.
Workaround consisted in compiling a list of individual field objects and getting the name property for each. This gave me a list of the rows of all the fields in this list.
res = [f.name for f in message.DESCRIPTOR.fields]
Note that this does not give you field names inside these fields recursively.
ypx
source share