使用Python将文件上传到Google Cloud Storage签名的URL

时间:2018-07-27 07:44:17

标签: python google-cloud-platform google-cloud-storage

有人可以通过代码帮助我,最好使用Requests库将文件上传到Python中的Google Cloud Storage签名URL吗?

2 个答案:

答案 0 :(得分:1)

您可以在Github上查看此sample code。它显示了一种使用PyCrypto和请求实现此目标的可移植方法。

请注意,如果您的应用程序在App Engine上运行,则可以使用here中所述的App Engine身份服务及其sign_blob()方法对字符串进行轻松签名。

答案 1 :(得分:-1)

如LundinCast的答案所述,这里是sample code的AppEngine应用程序,它使用@Configuration @EnableAutoConfiguration public class SecurityConfiguration { @Bean EvaluationContextExtension securityExtension() { return new SecurityEvaluationContextExtension(); } } 。我确认它可以正常工作。