开发者

Receiving email with .csv attachment with google app engine

开发者 https://www.devze.com 2023-02-19 08:00 出处:网络
I have been able to read em开发者_StackOverflow社区ails, and I can see the attachments, but they don\'t come in as .csv data. I guess it is an \'EncodedPayload\' type?

I have been able to read em开发者_StackOverflow社区ails, and I can see the attachments, but they don't come in as .csv data. I guess it is an 'EncodedPayload' type?

The following code:

for filename, content in attachments:
    logging.info("filename: " + filename)
    fileReader = csv.reader(content.split("\n"))

gave me this error:

'EncodedPayload' object has no attribute 'split'

How do I parse a csv file given an EncodedPayload ?


call decode() on your content:

fileReader = csv.reader(content.decode())
0

精彩评论

暂无评论...
验证码 换一张
取 消