Skip to content

Commit

Permalink
add device status & update smsmessage method
Browse files Browse the repository at this point in the history
  • Loading branch information
Helperhaps committed May 17, 2018
1 parent b0e8425 commit 9e6d789
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions examples/device_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ def update_device_mobile():
reg_id = '1507bfd3f7c466c355c'
entity = jpush.device_mobile("18588232140")
device.set_devicemobile(reg_id, entity)

def get_device_status():
reg_id = '1507bfd3f7c466c355c'
device.get_device_status(reg_id)
2 changes: 1 addition & 1 deletion jpush/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
schedulepayload,
]

__version__ = '3.2.9'
__version__ = '3.3.0'
VERSION = tuple(map(int, __version__.split('.')))

# Silence urllib3 INFO logging by default
Expand Down
12 changes: 12 additions & 0 deletions jpush/device/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ def get_aliasuser(self, alias, platform=None):
info = self.send("GET", url, params = params)
return info

def get_device_status(self, reg_ids):
"""Get Online Status of User (VIP Exclusive Interface)
"""
url = common.get_url('device', self.zone) + 'status'

if isinstance(reg_ids, str):
reg_ids = [ reg_ids ]

entity = { 'registration_ids': reg_ids }
body = json.dumps(entity)
info = self.send("POST", url, body)
return info

class DeviceResponse(object):
"""Response to a successful device request send.
Expand Down
7 changes: 4 additions & 3 deletions jpush/push/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,12 @@ def message(msg_content, title=None, content_type=None, extras=None):
payload['extras'] = extras
return payload


def smsmessage(content,delay_time):
def smsmessage(delay_time, temp_id, temp_para = None):
payload = {}
payload["content"]=content
payload["delay_time"]=delay_time
payload["temp_id"]=temp_id
if temp_para is not None:
payload['temp_para'] = temp_para
return payload


Expand Down

0 comments on commit 9e6d789

Please sign in to comment.