I'm getting an attachment from an email Message object and creating a tempfile like so:
import tempfile
with tempfile.NamedTemporaryFile() as temp:
temp.write(payload.get_payload(decode=True))
Is it possible to get the md5 out of this tempfile or do I have to save it to disk and then get the md5? Something like so would be what I'm aiming for:
import hashlib
print(hashlib.md5(temp).hexdigest())
But I run into this error
TypeError: object supporting the buffer API required