How can I get the payload from a Message other than calling message.__str__()?
I've spent some time looking for it and I couldn't find any. It's just weird to call it that way. I tried body() method but it returns a complex object instead of the actual "body" by which I mean the payload.
Tutorials and examples also give the standard print(message).
Am I missing something?
Tried the reference too..
Hi @epomatti thanks for asking, I'm tagging it for the right team take a look at this.
Thanks @epomatti - you can access the data using the body attribute you described. This field simply returns a generator.
Messages can contain multiple sections of data, which is why it's present this way. So you could interact with it multiple ways:
data = next(message.body)
data = list(message.body)[0]
@annatisch thanks that did the trick, python newbie here
Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.
Most helpful comment
Thanks @epomatti - you can access the data using the
bodyattribute you described. This field simply returns a generator.Messages can contain multiple sections of data, which is why it's present this way. So you could interact with it multiple ways: