本文整理汇总了Python中message.Message.time方法的典型用法代码示例。如果您正苦于以下问题:Python Message.time方法的具体用法?Python Message.time怎么用?Python Message.time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message.Message
的用法示例。
在下文中一共展示了Message.time方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onGroup_MessageReceived
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import time [as 别名]
def onGroup_MessageReceived(self, messageId, jid, author, messageContent, timestamp, wantsReceipt, pushName):
message = Message(kind="wa", nick_full=author, chan=jid, msg=messageContent)
message.time = Timestamp(ms_int = timestamp*1000)
self.msg_handler(message)
sendReceipts = True
if wantsReceipt and sendReceipts:
self.wait_connected()
self.methodsInterface.call("message_ack", (jid, messageId))
示例2: onMessageReceived
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import time [as 别名]
def onMessageReceived(self, messageId, jid, messageContent, timestamp, wantsReceipt, pushName, dummy):
messageContent = unicode(messageContent, "utf-8")
message = Message(kind="wa", nick_full=jid, chan=self.username, msg=messageContent)
message.time = Timestamp(ms_int = timestamp*1000)
self.msg_handler(message)
sendReceipts = True
if wantsReceipt and sendReceipts:
self.wait_connected()
self.methodsInterface.call("message_ack", (jid, messageId))
示例3: Message
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import time [as 别名]
from __future__ import print_function
import os
import time
import json
import datetime
import argparse
import requests
from message import Message
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-f','--format', default="protobuf", choices=["protobuf","json"], help="message format")
parser.add_argument('CONFIG', type=argparse.FileType('r'), help="configuration file")
parser.add_argument('URL', help="tavis url")
args = parser.parse_args()
config = json.load(args.CONFIG)
shared_secret = config.get('shared_secret', 'ultrasafesecret')
msg = Message(random_payload=False)
msg.time = int(time.time())
resp = requests.post(args.URL, headers={
'X-Hamustro-Time': msg.time,
'X-Hamustro-Signature': msg.signature(shared_secret, args.format),
'Content-Type': 'application/{}; charset=utf-8'.format(args.format)
}, data=msg.get_body(args.format))
print('Response code: {}'.format(resp.status_code))