当前位置: 首页>>代码示例>>Python>>正文


Python Message.time方法代码示例

本文整理汇总了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))
开发者ID:Ejeus,项目名称:breakbot,代码行数:10,代码来源:wa_bot.py

示例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))
开发者ID:sciuro,项目名称:breakbot,代码行数:11,代码来源:wa_bot.py

示例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))
开发者ID:andreiursan,项目名称:hamustro,代码行数:29,代码来源:send_single_message.py


注:本文中的message.Message.time方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。