Skip to content

Commit

Permalink
Add start_time example using pendulum
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Leland committed May 24, 2017
1 parent 61ba6d1 commit d9d7e23
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion examples/transmissions/schedule_transmission.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
"""
This example use the pendulum python package, which has a nice API for
datetime/timezone handling. You can use pytz or prepare your own datetimes.
"""
import pendulum
from sparkpost import SparkPost

# create a datetime for two days from now
now = pendulum.now('Europe/Paris')
now = now.add(days=2)

sp = SparkPost()

response = sp.transmissions.post({
'options': {
'sandbox': True,
'start_time': '2015-11-06T09:10:00-05:00',
'start_time': now.to_iso8601_string(),
},
'recipients': [
'postmaster@example.com',
Expand Down

0 comments on commit d9d7e23

Please sign in to comment.