# Slixmpp: The Slick XMPP Library# This file is part of Slixmpp# See the file LICENSE for copying permissionimportreimportbase64fromslixmpp.utilimportbytesfromslixmpp.exceptionsimportXMPPErrorfromslixmpp.xmlstreamimportElementBaseVALID_B64=re.compile(r'[A-Za-z0-9\+\/]*=*')
[docs]defget_data(self):text=self.xml.textifnottext:raiseXMPPError('not-acceptable','IBB data element is empty.')b64_data=text.strip()ifVALID_B64.match(b64_data).group()==b64_data:returnfrom_b64(b64_data)else:raiseXMPPError('not-acceptable')