![]() import base64ĭef GetAttachments(service, user_id, msg_id, store_dir=""): Inspired by this answer, here is my approach to the problem. Schurov or T answers, the reason is because the email structure can be different based on the mimeType. You can still miss attachments by following V. ![]() Message = ers().messages().get(userId=user_id, id=msg_id).execute()Ītt = ers().messages().attachments().get(userId=user_id, messageId=msg_id,id=att_id).execute()įile_data = base64.urlsafe_b64decode(data.encode('UTF-8')) :param msg_id: ID of Message containing attachment. The special value "me" can be used to indicate the authenticated user. :param service: Authorized Gmail API service instance. """Get and store attachment from Message with given id. # which is licensed under Apache 2.0 Licenseĭef GetAttachments(service, user_id, msg_id): Expanding answer, I wrote the following corrected version of GetAttachments function from the docs: # based on Python example from
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |