Skip to content

Commit ae9b362

Browse files
committed
Add an add function to message_header
This to offload from the users the need to know the exact format of the datastructure (having a list of dicts with specific keys).
1 parent f9f42c3 commit ae9b362

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

O365/message.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,14 @@ def message_headers(self, value):
639639
self.__message_headers = value
640640
self._track_changes.add('message_headers')
641641

642+
def add_message_header(self, name, value):
643+
# Look if we already have the key. If we do, update it, otherwise write
644+
for header in self.__message_headers:
645+
if header["name"] == name:
646+
header["value"] = value
647+
return
648+
self.__message_headers.append({"name": name, "value": value})
649+
642650
def to_api_data(self, restrict_keys=None):
643651
""" Returns a dict representation of this message prepared to be sent
644652
to the cloud

0 commit comments

Comments
 (0)