Commit 3380379e authored by hupantingxue's avatar hupantingxue

JPush python client 3.0: fix python indient issue;

parent 25a32298
...@@ -25,4 +25,4 @@ def audience(*children): ...@@ -25,4 +25,4 @@ def audience(*children):
{'audience': {'tag': 'sports'}, {'tag_and': 'business'}} {'audience': {'tag': 'sports'}, {'tag_and': 'business'}}
""" """
return {"audience": {child for child in children}} return {"audience": [child for child in children]}
...@@ -20,7 +20,7 @@ def notification(alert=None, ios=None, android=None, winphone=None): ...@@ -20,7 +20,7 @@ def notification(alert=None, ios=None, android=None, winphone=None):
if android is not None: if android is not None:
payload['android'] = android payload['android'] = android
if winphone is not None: if winphone is not None:
payload['winphone'] = winphone payload['winphone'] = winphone
if not payload: if not payload:
raise ValueError("Notification body may not be empty") raise ValueError("Notification body may not be empty")
return payload return payload
...@@ -57,7 +57,7 @@ def ios(alert=None, badge=None, sound=None, content_available=False, ...@@ -57,7 +57,7 @@ def ios(alert=None, badge=None, sound=None, content_available=False,
if sound is not None: if sound is not None:
payload['sound'] = sound payload['sound'] = sound
else: else:
payload['sound'] = 'default' payload['sound'] = 'default'
if content_available: if content_available:
payload['content-available'] = 1 payload['content-available'] = 1
if extra is not None: if extra is not None:
...@@ -83,7 +83,7 @@ def android(alert, title=None, builder_id=None, extras=None): ...@@ -83,7 +83,7 @@ def android(alert, title=None, builder_id=None, extras=None):
if title is not None: if title is not None:
payload['title'] = collapse_key payload['title'] = collapse_key
if builder_id is not None: if builder_id is not None:
payload['builder_id'] = builder_id payload['builder_id'] = builder_id
if extra is not None: if extra is not None:
payload['extra'] = extra payload['extra'] = extra
return payload return payload
...@@ -101,11 +101,11 @@ def winphone(alert, title=None, _open_page=None, extras=None): ...@@ -101,11 +101,11 @@ def winphone(alert, title=None, _open_page=None, extras=None):
if alert is not None: if alert is not None:
payload['alert'] = alert payload['alert'] = alert
if title is not None: if title is not None:
payload['title'] = title payload['title'] = title
if _open_page is not None: if _open_page is not None:
payload['_open_page'] = _open_page payload['_open_page'] = _open_page
if extras is not None: if extras is not None:
payload['extras'] = extras payload['extras'] = extras
return payload return payload
def message(msg_content, title=None, content_type=None, extras=None): def message(msg_content, title=None, content_type=None, extras=None):
...@@ -121,11 +121,11 @@ def message(msg_content, title=None, content_type=None, extras=None): ...@@ -121,11 +121,11 @@ def message(msg_content, title=None, content_type=None, extras=None):
'msg_content': msg_content, 'msg_content': msg_content,
} }
if title is not None: if title is not None:
payload['title'] = title payload['title'] = title
if content_type is not None: if content_type is not None:
payload['content_type'] = content_type payload['content_type'] = content_type
if extras is not None: if extras is not None:
payload['extras'] = extras payload['extras'] = extras
return payload return payload
def platform(*types): def platform(*types):
...@@ -148,4 +148,4 @@ def platform(*types): ...@@ -148,4 +148,4 @@ def platform(*types):
def options(options): def options(options):
"""Create options object.""" """Create options object."""
return {"options": options} return {"options": options}
...@@ -2,7 +2,7 @@ import unittest ...@@ -2,7 +2,7 @@ import unittest
import sys import sys
sys.path.append('../..') sys.path.append('../..')
import jpush as jpush import jpush as jpush
class TestAudience(unittest.TestCase): class TestAudience(unittest.TestCase):
......
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