本文整理汇总了Python中message.Message.append方法的典型用法代码示例。如果您正苦于以下问题:Python Message.append方法的具体用法?Python Message.append怎么用?Python Message.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message.Message
的用法示例。
在下文中一共展示了Message.append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: data
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import append [as 别名]
def data(self):
msg = Message()
for carrier in self.carriers:
msg.append(Record('urn:nfc:wkt:ac', data=str(carrier)))
if self.error.reason is not None:
msg.append(Record("urn:nfc:wkt:err", data=str(self.error)))
return str(self.version) + str(msg)
示例2: __str__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import append [as 别名]
def __str__(self):
message = Message(HandoverSelectRecord())
message[0].name = self.name
message[0].version = self.version
message[0].error = self.error
for cref, carrier in enumerate(self.carriers):
ac = AlternativeCarrier()
ac.carrier_power_state = carrier.power_state
ac.carrier_data_reference = str(cref)
carrier.record.name = ac.carrier_data_reference
message.append(carrier.record)
for aref, aux in enumerate(carrier.auxiliary_data_records):
aux.name = "aux"+str(aref)
message.append(aux)
ac.auxiliary_data_reference_list.append(aux.name)
message[0].carriers.append(ac)
return str(message)
示例3: data
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import append [as 别名]
def data(self):
# encode smart poster payload as ndef message
message = Message(UriRecord(self._uri))
for lang, text in self.title.iteritems():
message.append(TextRecord(text=text, language=lang))
for image_type, image_data in self.icons.iteritems():
message.append(Record("image/"+image_type, data=image_data))
if self._action >= 0:
message.append(Record("urn:nfc:wkt:act", data=chr(self._action)))
if self._res_size:
size = struct.pack('>L', self._res_size)
message.append(Record("urn:nfc:wkt:s", data=size))
return str(message)