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


Python Message.token方法代码示例

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


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

示例1: _test_with_client_observe

# 需要导入模块: from coapthon.messages.message import Message [as 别名]
# 或者: from coapthon.messages.message.Message import token [as 别名]
 def _test_with_client_observe(self, message_list, callback):
     client = HelperClient(self.server_address)
     token = None
     last_mid = 0
     for message, expected in message_list:
         if message is not None:
             token = message.token
             client.send_request(message, callback)
         received_message = self.queue.get()
         if expected is not None:
             last_mid = expected.mid
             if expected.type is not None:
                 self.assertEqual(received_message.type, expected.type)
             if expected.mid is not None:
                 self.assertEqual(received_message.mid, expected.mid)
             self.assertEqual(received_message.code, expected.code)
             if expected.source is not None:
                 self.assertEqual(received_message.source, self.server_address)
             if expected.token is not None:
                 self.assertEqual(received_message.token, expected.token)
             if expected.payload is not None:
                 self.assertEqual(received_message.payload, expected.payload)
             if expected.options is not None:
                 self.assertEqual(received_message.options, expected.options)
     message = Message()
     message.type = defines.Types["RST"]
     message.token = token
     message._mid = last_mid
     message.destination = self.server_address
     client.send_empty(message)
     client.stop()
开发者ID:yukusu,项目名称:IoT-Rasp,代码行数:33,代码来源:plugtest.py

示例2: cancel_observing

# 需要导入模块: from coapthon.messages.message import Message [as 别名]
# 或者: from coapthon.messages.message.Message import token [as 别名]
 def cancel_observing(self, response, send_rst):  # pragma: no cover
     if send_rst:
         message = Message()
         message.destination = self.server
         message.code = defines.Codes.EMPTY.number
         message.type = defines.Types["RST"]
         message.token = response.token
         message.mid = response.mid
         self.protocol.send_message(message)
     self.stop()
开发者ID:Erguotou,项目名称:CoAPthon,代码行数:12,代码来源:helperclient.py

示例3: end_observation

# 需要导入模块: from coapthon.messages.message import Message [as 别名]
# 或者: from coapthon.messages.message.Message import token [as 别名]
    def end_observation(self, token):
        """
        Remove an observation token from our records.

        :param token: the token for the observation
        """
        dummy = Message()
        dummy.token = token
        dummy.destination = self._server
        self._observeLayer.remove_subscriber(dummy)
开发者ID:Tanganelli,项目名称:CoAPthon,代码行数:12,代码来源:coap.py

示例4: coap_encode

# 需要导入模块: from coapthon.messages.message import Message [as 别名]
# 或者: from coapthon.messages.message.Message import token [as 别名]
def coap_encode(payload):
    message = Message()
    message.type = defines.Types['CON']
    message.token = 4321
    message.mid = 2
    message.options = None
    message.payload = str(payload)
    serializer = Serializer()
    messagestring = serializer.serialize(message)
    return messagestring
开发者ID:Omosofe,项目名称:NGINX-Demos,代码行数:12,代码来源:sensor-coap.py


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