Closed martinthurn closed 5 years ago
Instead of adding another method, would you consider just referencing the payload class attribute? It's a python object, but can also be dumped to json or pretty printed.
Example:
# setup
teams_message = pymsteams.connectorcard(os.getenv("MS_TEAMS_WEBHOOK"))
teams_message.text("This is a simple text message.")
teams_message.title("Simple Message Title")
# dump to json string
import json
json.dumps(teams_message.payload)
# output: '{"text": "This is a simple text message.", "title": "Simple Message Title"}'
# pretty printing
import pprint
pprint.pprint(teams_message.payload)
# output: {'text': 'This is a simple text message.', 'title': 'Simple Message Title'}
This is good, thank you!
Or rather, I guess it would be nice to have a new method such as as_string() so that we can get a string and print it to where WE choose (e.g. log file).