for attachment in email['attachments']: # save each attachment in current directory file_name = attachment['filename'] content_type = attachment['content_type'] data = attachment['data'] with open(file_name, 'w') as f: f.write(data)
но почему-то файлы которые скачиваются пустые или вовсе не открываются, может кто знает в чем причина?