如何在Python中将流(来自s3存储桶的文件(pdf、ppt等)的文件流)编码为base64string,以便使用Rest API跨网络发送
如何在 python 中将流(使用 boto3 从 s3 存储桶中的文件(pdf、ppt 等)的文件流)编码为 base64string 以跨网络发送
本质上如何在 python 中为下面的 c# 示例执行 base64 转换
DocumentBody = Convert.ToBase64String(字节)
private void UploadDocumentsToEntity(Entity entity, Byte[] bytes, string fileName, string documentDescription, SystemUser systemUser)
{
Annotation setupAnnotation = new Annotation()
{
Subject = documentDescription, //"Entity - Document Attachment" + fileName
FileName = fileName,
DocumentBody = Convert.ToBase64String(bytes),
MimeType = GetMimeType(fileName),
ObjectId = new EntityReference(entity.LogicalName, entity.Id),
OwnerId = new EntityReference("systemuser", systemUser.Id)
};
Guid annotationId = _serviceProxy.Create(setupAnnotation);
}
How to encode a stream (filestream of a file (pdf, ppt etcc.) from s3 bucket using boto3) to base64string in python for sending across network
In essential how to do the base64 conversion below in python for c# sample below
DocumentBody = Convert.ToBase64String(bytes)
private void UploadDocumentsToEntity(Entity entity, Byte[] bytes, string fileName, string documentDescription, SystemUser systemUser)
{
Annotation setupAnnotation = new Annotation()
{
Subject = documentDescription, //"Entity - Document Attachment" + fileName
FileName = fileName,
DocumentBody = Convert.ToBase64String(bytes),
MimeType = GetMimeType(fileName),
ObjectId = new EntityReference(entity.LogicalName, entity.Id),
OwnerId = new EntityReference("systemuser", systemUser.Id)
};
Guid annotationId = _serviceProxy.Create(setupAnnotation);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们只是做
we simply do