Skip to content

Commit 6606e8d

Browse files
authored
docs: correct attachment example (#936)
1 parent 9392eab commit 6606e8d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

examples/helpers/mail_example.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ def build_attachment1():
8383
"""Build attachment mock. Make sure your content is base64 encoded before passing into attachment.content.
8484
Another example: https://github.com/sendgrid/sendgrid-python/blob/HEAD/use_cases/attachment.md"""
8585
attachment = Attachment()
86-
attachment.content = ("TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNl"
86+
attachment.file_content = ("TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNl"
8787
"Y3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12")
88-
attachment.type = "application/pdf"
89-
attachment.filename = "balance_001.pdf"
88+
attachment.file_type = "application/pdf"
89+
attachment.file_name = "balance_001.pdf"
9090
attachment.disposition = "attachment"
9191
attachment.content_id = "Balance Sheet"
9292
return attachment
@@ -95,9 +95,9 @@ def build_attachment1():
9595
def build_attachment2():
9696
"""Build attachment mock."""
9797
attachment = Attachment()
98-
attachment.content = "BwdW"
99-
attachment.type = "image/png"
100-
attachment.filename = "banner.png"
98+
attachment.file_content = "BwdW"
99+
attachment.file_type = "image/png"
100+
attachment.file_name = "banner.png"
101101
attachment.disposition = "inline"
102102
attachment.content_id = "Banner"
103103
return attachment
@@ -227,19 +227,19 @@ def build_kitchen_sink():
227227
]
228228

229229
message.attachment = Attachment(FileContent('base64 encoded content 1'),
230-
FileType('application/pdf'),
231230
FileName('balance_001.pdf'),
231+
FileType('application/pdf'),
232232
Disposition('attachment'),
233233
ContentId('Content ID 1'))
234234
message.attachment = [
235235
Attachment(FileContent('base64 encoded content 2'),
236-
FileType('image/png'),
237236
FileName('banner.png'),
237+
FileType('image/png'),
238238
Disposition('inline'),
239239
ContentId('Content ID 2')),
240240
Attachment(FileContent('base64 encoded content 3'),
241-
FileType('image/png'),
242241
FileName('banner2.png'),
242+
FileType('image/png'),
243243
Disposition('inline'),
244244
ContentId('Content ID 3'))
245245
]

0 commit comments

Comments
 (0)