本文整理汇总了Python中coapthon.messages.request.Request.add_query方法的典型用法代码示例。如果您正苦于以下问题:Python Request.add_query方法的具体用法?Python Request.add_query怎么用?Python Request.add_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coapthon.messages.request.Request
的用法示例。
在下文中一共展示了Request.add_query方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_td_coap_link_02
# 需要导入模块: from coapthon.messages.request import Request [as 别名]
# 或者: from coapthon.messages.request.Request import add_query [as 别名]
def test_td_coap_link_02(self):
print "TD_COAP_LINK_02"
path = "/.well-known/core"
req = Request()
req.code = defines.inv_codes['GET']
req.uri_path = path
req.type = defines.inv_types["CON"]
req._mid = self.current_mid
req.destination = self.server_address
req.add_query("rt=Type1")
expected = Response()
expected.type = defines.inv_types["ACK"]
expected._mid = self.current_mid
expected.code = defines.responses["CONTENT"]
expected.token = None
option = Option()
option.number = defines.inv_options["Content-Type"]
option.value = defines.inv_content_types["application/link-format"]
expected.add_option(option)
expected.payload = """</seg1/seg2/seg3>;rt="Type1",</seg1/seg2>;rt="Type1",</test>;rt="Type1",</seg1>;rt="Type1",</query>;rt="Type1","""
self.current_mid += 1
self._test_plugtest([(req, expected)])