我正在从 echosign API 中提取一个 pdf,它为我提供了文件的字节数。
我正在尝试获取这些字节并将它们保存到 boto s3 支持的 FileField 中。我运气不太好。
这是我得到的最接近的,但它在保存“扬声器”时出错,并且 pdf 虽然写入 S3,但似乎已损坏。
这speaker
是我的模型的一个实例,fileData 是从 echosign api 返回的“字节”字符串
afile = speaker.the_file = S3BotoStorageFile(filename, "wb", S3BotoStorage())
afile.write(fileData)
afile.close()
speaker.save()