I want to push my email attachment to s3 bucket using python, my following piece of code doing that task but when new email hits with different file name this is not working.
I want to upload any dynamic name and extension to the s3 bucket.
I am new bee in python.
Thanks in advance.
# Write the attachment to a temp location
open('/tmp/filename.csv', 'wb').write(attachment.get_payload(decode=True))
You can use the following code to extract the attachment from the lambda:
Its described here: https://medium.com/caspertechteam/processing-email-attachments-with-aws-a35a1411a0c4