Commit eef88eb0 authored by fendouai's avatar fendouai

fix sms_message when it is none

parent 32689984
app_key = u'6be9204c30b9473e87bad4dc' app_key = u'6be9204c30b9473e87bad4dc'
master_secret = u'8aae478411e89f7682ed5af6' master_secret = u'9349ad7c90292a603c512e92'
app_key = u'6be9204c30b9473e87bad4dc' app_key = u'6be9204c30b9473e87bad4dc'
master_secret = u'8aae478411e89f7682ed5af6' master_secret = u'9349ad7c90292a603c512e92'
...@@ -7,6 +7,7 @@ push.audience = jpush.audience( ...@@ -7,6 +7,7 @@ push.audience = jpush.audience(
jpush.tag("tag1", "tag2"), jpush.tag("tag1", "tag2"),
jpush.alias("alias1", "alias2") jpush.alias("alias1", "alias2")
) )
push.notification = jpush.notification(alert="Hello, world with audience!") push.notification = jpush.notification(alert="Hello world with audience!")
push.platform = jpush.all_ push.platform = jpush.all_
print push.payload
push.send() push.send()
...@@ -22,12 +22,13 @@ class Push(object): ...@@ -22,12 +22,13 @@ class Push(object):
data = { data = {
"audience": self.audience, "audience": self.audience,
"platform": self.platform, "platform": self.platform,
"sms_message":self.smsmessage,
} }
if (self.notification is None) and (self.message is None): if (self.notification is None) and (self.message is None):
raise ValueError("Notification and message cannot be both empty") raise ValueError("Notification and message cannot be both empty")
if self.notification is not None: if self.notification is not None:
data['notification'] = self.notification data['notification'] = self.notification
if self.smsmessage is not None:
data['sms_message'] = self.sms_message
if self.options is not None: if self.options is not None:
data['options'] = self.options data['options'] = self.options
if self.message is not None: if self.message is not None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment