本文整理汇总了Python中coapthon.messages.request.Request._payload方法的典型用法代码示例。如果您正苦于以下问题:Python Request._payload方法的具体用法?Python Request._payload怎么用?Python Request._payload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coapthon.messages.request.Request
的用法示例。
在下文中一共展示了Request._payload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from coapthon.messages.request import Request [as 别名]
# 或者: from coapthon.messages.request.Request import _payload [as 别名]
def post(self, client_callback, *args, **kwargs):
if isinstance(args, tuple):
path, payload = args
req = Request()
req.uri_path = path
req._payload = payload
if "Token" in kwargs.keys():
req.token = kwargs.get("Token")
del kwargs["Token"]
if "MID" in kwargs.keys():
req.mid = kwargs.get("MID")
del kwargs["MID"]
if "Server" in kwargs.keys():
req.destination = kwargs.get("Server")
del kwargs["Server"]
else:
req = args[0]
for key in kwargs:
try:
o = Option()
o.number = defines.inv_options[key]
o.value = kwargs[key]
req.add_option(o)
except KeyError:
pass
req.code = defines.inv_codes['POST']
req.type = defines.inv_types["CON"]
self.send_callback(req, self.post_results, client_callback)