Skip to content

Commit d5bc6a7

Browse files
author
Rich Leland
committed
Update docs for inline images
1 parent 6dc367c commit d5bc6a7

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

sparkpost/transmissions.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,26 @@ def send(self, **kwargs):
181181
name='document.pdf',
182182
filename='/full/path/to/document.pdf'
183183
)
184+
:param inline_images: List of dicts. For example:
185+
186+
.. code-block:: python
187+
188+
dict(
189+
type='image/png',
190+
name='imageCID',
191+
data='base64 encoded string'
192+
)
193+
194+
Replace `data` with `filename` if you want the library to perform
195+
the base64 conversion. For example:
196+
197+
.. code-block:: python
198+
199+
dict(
200+
type='image/png',
201+
name='imageCID',
202+
filename='/full/path/to/image.png'
203+
)
184204
185205
:param str start_time: Delay generation of messages until this
186206
datetime. Format YYYY-MM-DDTHH:MM:SS+-HH:MM. Example:

test/test_transmissions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def test_success_send_with_inline_images():
189189
sp = SparkPost('fake-key')
190190

191191
image_data = {
192-
"name": "sparkpostdev.png",
192+
"name": "sparkpostdev",
193193
"type": "image/png",
194194
"filename": image_path
195195
}
@@ -201,8 +201,8 @@ def test_success_send_with_inline_images():
201201
assert results == 'yay'
202202

203203
image_data = {
204-
"name": "test.txt",
205-
"type": "text/plain",
204+
"name": "sparkpostdev",
205+
"type": "image/png",
206206
"data": encoded_image
207207
}
208208
results = sp.transmission.send(inline_images=[image_data])

0 commit comments

Comments
 (0)