Skip to content

Commit 9e6d789

Browse files
author
Helperhaps
committed
add device status & update smsmessage method
1 parent b0e8425 commit 9e6d789

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

examples/device_example.py

+4
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,7 @@ def update_device_mobile():
5252
reg_id = '1507bfd3f7c466c355c'
5353
entity = jpush.device_mobile("18588232140")
5454
device.set_devicemobile(reg_id, entity)
55+
56+
def get_device_status():
57+
reg_id = '1507bfd3f7c466c355c'
58+
device.get_device_status(reg_id)

jpush/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
schedulepayload,
7676
]
7777

78-
__version__ = '3.2.9'
78+
__version__ = '3.3.0'
7979
VERSION = tuple(map(int, __version__.split('.')))
8080

8181
# Silence urllib3 INFO logging by default

jpush/device/core.py

+12
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ def get_aliasuser(self, alias, platform=None):
8888
info = self.send("GET", url, params = params)
8989
return info
9090

91+
def get_device_status(self, reg_ids):
92+
"""Get Online Status of User (VIP Exclusive Interface)
93+
"""
94+
url = common.get_url('device', self.zone) + 'status'
95+
96+
if isinstance(reg_ids, str):
97+
reg_ids = [ reg_ids ]
98+
99+
entity = { 'registration_ids': reg_ids }
100+
body = json.dumps(entity)
101+
info = self.send("POST", url, body)
102+
return info
91103

92104
class DeviceResponse(object):
93105
"""Response to a successful device request send.

jpush/push/payload.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,12 @@ def message(msg_content, title=None, content_type=None, extras=None):
158158
payload['extras'] = extras
159159
return payload
160160

161-
162-
def smsmessage(content,delay_time):
161+
def smsmessage(delay_time, temp_id, temp_para = None):
163162
payload = {}
164-
payload["content"]=content
165163
payload["delay_time"]=delay_time
164+
payload["temp_id"]=temp_id
165+
if temp_para is not None:
166+
payload['temp_para'] = temp_para
166167
return payload
167168

168169

0 commit comments

Comments
 (0)