本文整理汇总了Python中Channel.getRequestId方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.getRequestId方法的具体用法?Python Channel.getRequestId怎么用?Python Channel.getRequestId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel.getRequestId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Channel
# 需要导入模块: import Channel [as 别名]
# 或者: from Channel import getRequestId [as 别名]
import time
sys.path.append("..")
from Channel import *
channel_id = 'your_channel_id' #android
msg = '{"title":"Message from Push","description":"hello world"}'
#msg_ios = '{"aps":{"alert":"iOS Message from Push","sound":"","badge":1},"key1":"value1","key2":"value2"}'
opts = {'msg_type':1, 'expires':300}
c = Channel()
try:
ret = c.pushMsgToSingleDevice(channel_id, msg, opts)
print('ret: ', end=' ')
print(ret)
print(c.getRequestId())
except ChannelException as e:
print('[code]', end=' ')
print(e.getLastErrorCode())
print('[msg]', end=' ')
print(e.getLastErrorMsg())
print('[request id]', end=' ')
print(c.getRequestId())
try:
ret = c.pushMsgToAll(msg, opts)
print('ret: ', end=' ')
print(ret)
print(c.getRequestId())
except ChannelException as e:
print('[code]', end=' ')
示例2: Channel
# 需要导入模块: import Channel [as 别名]
# 或者: from Channel import getRequestId [as 别名]
import time
sys.path.append("..")
from Channel import *
channel_id = 'your_channel_id' #android
msg = '{"title":"Message from Push","description":"hello world"}'
#msg_ios = '{"aps":{"alert":"iOS Message from Push","sound":"","badge":1},"key1":"value1","key2":"value2"}'
opts = {'msg_type':1, 'expires':300}
c = Channel()
try:
ret = c.pushMsgToSingleDevice(channel_id, msg, opts)
print 'ret: ',
print ret
print c.getRequestId()
except ChannelException as e:
print '[code]',
print e.getLastErrorCode()
print '[msg]',
print e.getLastErrorMsg()
print '[request id]',
print c.getRequestId()
try:
ret = c.pushMsgToAll(msg, opts)
print 'ret: ',
print ret
print c.getRequestId()
except ChannelException as e:
print '[code]',