yowsup icon indicating copy to clipboard operation
yowsup copied to clipboard

Getting profile picture url

Open lcmeyer37 opened this issue 11 years ago • 3 comments

Hey people, I have a question, the way I've implemented to get the profile picture of someone who sent me a message was just creating a PictureIqProtocolEntity using his jid and sending it to lower, on the same custom layer I have a protocol callback iq to receive this iq result and then I save the picture data of this entity received. Is there another easier way to get the profile picture? Can I also get the url of a certain profile picture given its jid?

Thank you,

Lucas Meyer

lcmeyer37 avatar Apr 24 '15 09:04 lcmeyer37

profile picture is only received in node data by request.

CODeRUS avatar Apr 24 '15 09:04 CODeRUS

So, the only way to get the profile picture was the way I've done below? I've put this callback on my custom layer:

@ProtocolEntityCallback('iq') def onIq(self, entity):

        salvarComo = os.path.dirname(os.path.realpath(__file__)) + '/fdb/' + 'name-fdb.jpg'
        rawFoto = entity.pictureData.encode('ISO-8859-1')
        foto = open(salvarComo, 'wb')
        foto.write(rawFoto)
        foto.close() 

lcmeyer37 avatar Apr 24 '15 11:04 lcmeyer37

Yup that is the only way.

tgalal avatar May 02 '15 16:05 tgalal