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


Python Message.address方法代码示例

本文整理汇总了Python中message.Message.address方法的典型用法代码示例。如果您正苦于以下问题:Python Message.address方法的具体用法?Python Message.address怎么用?Python Message.address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在message.Message的用法示例。


在下文中一共展示了Message.address方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sendHeartBeat

# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import address [as 别名]
 def sendHeartBeat(self):
     """Sends message alerting other peers to your presence."""
     message = Message(heartbeatMsg, self.sessionID)
     message.name = self.name
     message.address = self.tcpAddress
     message.tcpPort = self.tcpPort
     self.sendMessage(message)
     log.msg("Sent " + str(message))
开发者ID:arminhammer,项目名称:teiler,代码行数:10,代码来源:peerdiscovery.py

示例2: stopProtocol

# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import address [as 别名]
 def stopProtocol(self):
     """Gracefully tell peers to remove you."""
     message = Message(exitMsg, self.sessionID)
     message.name = self.name
     message.address = self.teiler.tcpAddress
     message.tcpPort = self.teiler.tcpPort
     self.sendMessage(message)
     self.loop.stop()
     log.msg("Exit " + message)
开发者ID:arminhammer,项目名称:teiler,代码行数:11,代码来源:peerdiscovery.py

示例3: receive

# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import address [as 别名]
    def receive(self, message):
        url = self.request.path
        to = url.split('/')[-1]
        address = to.split('@')[0]

        unique_id = str(uuid.uuid4())

        logging.info("================================")
        logging.info("From: " + message.sender)
        logging.info("To: " + to)
        logging.info("Address: " + address)
        logging.info("Subject: " + message.subject)
        logging.info("Date: " + message.original.get('Date'))
        logging.info("ID: " + unique_id)

        plaintext_bodies = message.bodies('text/plain')
        plaintext_body = ''
        if plaintext_bodies:
            for content_type, encoded_body in plaintext_bodies:
                logging.info("Content_type: " + content_type)
                plaintext_body = encoded_body.payload
                logging.info("Body: " + plaintext_body)

        html_bodies = message.bodies('text/html')
        html_body = ''
        if html_bodies:
            for content_type, encoded_body in html_bodies:
                html_body = encoded_body.decode()

        stored_message = Message()
        stored_message.uuid = unique_id
        stored_message.sender = message.sender
        stored_message.to = to
        stored_message.address = address
        stored_message.subject = message.subject
        stored_message.plain_text = plaintext_body
        stored_message.html = html_body
        stored_message.put()

        logging.info("================================")
开发者ID:hugs,项目名称:message-checker,代码行数:42,代码来源:handle_incoming_email.py


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