通过使用Python下载S3的CSV文件给CSV文件

发布于 2025-02-06 23:03:35 字数 536 浏览 2 评论 0原文

我需要一个应用程序来从s3 bucket中拾取一些csv文件,然后将它们发送到指定的收件人。我能够使用问题结束时的解决方案来使代码工作: 附件

但是,上面的该代码解决方案首先将文件完全下载到local Storage,然后再次读取它们并将其发送电子邮件。我的公司非常喜欢我找到一个解决方案,可以直接从s3直接通过电子邮件发送附件,而不必依赖local Storage。这可能吗?如果是这样,怎么样?

Note :我不使用aws lambda,只是从服务器运行的常规Python应用程序,与我所指的问题不同。

I need an application to pick up some csv files from an s3 bucket and e-mail them to specified recipients. I was able to make the code work using the solution present at the end of the question here:
Python Lambda to send files uploaded to s3 as email attachments

However, this code solution above first downloads the files entirely to local storage, then reads them again and e-mails them. My company strongly prefers I find a solution to e-mail the attachment directly from s3 without having to rely on local storage. Is this possible? If so, how?

Note: I am not using an AWS Lambda, just a regular python application run from a server, unlike the question I refer to.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

兔姬 2025-02-13 23:03:35

您可以设计在服务器上运行的Python应用程序,以通过> Serverless应用程序发送电子邮件。 serverless应用程序将在将其附加到电子邮件并发送电子邮件之前从S3下载对象。

/code> 具有SDK python开发。

事件的顺序看起来像

Actor
 |
Python App
 |
Lambda <-> s3
 |
 `
Email Server
 |
User

You could design your python application running on the server to send the email via serverless application, say. The serverless app would download the object from s3, before attaching it to the email and sending it.

AWS supports python, and serverless has an SDK for python development.

The sequence of events would look something like

Actor
 |
Python App
 |
Lambda <-> s3
 |
 `
Email Server
 |
User

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文