Skip to content

Commit e888b4f

Browse files
authored
Merge pull request #12 from Fredpwol/master
Added extra fields to be used for from_dictionary
2 parents 915c29a + 8902934 commit e888b4f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

message_media_messages/models/message.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,14 @@ def from_dictionary(cls,
112112
return None
113113

114114
# Extract variables from the dictionary
115-
content = dictionary.get('content')
116-
destination_number = dictionary.get('destination_number')
115+
attributes = ['callback_url', 'content', 'destination_number', 'delivery_report', 'format', 'message_expiry_timestamp',
116+
'metadata', 'scheduled', 'source_number', 'source_number_type', 'message_id', 'status', 'media', 'subject']
117+
118+
msg_dictionary = dict()
119+
for key, value in dictionary.items():
120+
if key in attributes:
121+
msg_dictionary[key] = value
117122

118123

119124
# Return an object of this model
120-
return cls(content,
121-
destination_number)
125+
return cls(**msg_dictionary)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from os import path
44
here = path.abspath(path.dirname(__file__))
55

6-
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
6+
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
77
long_description = f.read()
88

99
setup(

0 commit comments

Comments
 (0)