Thanks for posting your question in the Microsoft Q&A forum.
This should resolve the AttributeError
you encountered.
import base64
img_base64 = base64.b64encode(img_bytes).decode('utf-8')
response = await client.users.by_user_id('17c89e3d-f28f-459e-8738-cb4cfa17c3fe')
.photo.patch(body={
'@odata.type': 'microsoft.graph.profilePhoto',
'id': 'User photo ID',
'content': img_base64,
})
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful