Gae Python - How To Attach The Results Of Csv.writer To An Email?
On GAE Python I am writing a CSV from my datastore and would like to send it by email without storing it in the blobstore. This is intended to run as a CRON job once per day. The e
Solution 1:
You can do this
importStringIO
...
data = StringIO.StringIO()
writer = unicodecsv.writer(data, encoding='utf-8')
...
message = mail.EmailMessage(sender="Me <me@gmail.com>",
subject="Shop Export",
attachments=[("shops.csv", bytes(data.getvalue()))])
Solution 2:
try to modify this line.
message = mail.EmailMessage(sender="Me <me@gmail.com>",
subject="Shop Export",
attachments=[("shops.csv", self.response.body)])
Post a Comment for "Gae Python - How To Attach The Results Of Csv.writer To An Email?"