[英]Public URL to files in Google Cloud Storage from python backend (Google App Engine)
I'm developing an Android application, which communicates with backend Google App Engine written in Python. 我正在开发一个Android应用程序,该应用程序与使用Python编写的后端Google App Engine通信。 User is uploading and downloading files to Google Cloud Storage.
用户正在将文件上传和下载到Google Cloud Storage。 So far, the files where being sent to the GAE backend by POST request, and then saved in GCS.
到目前为止,文件已通过POST请求发送到GAE后端,然后保存在GCS中。 I want user to do it directly to GCS (to avoid sending large files over POST).
我希望用户直接将其发送到GCS(以避免通过POST发送大文件)。 And (on download request) I would like to send user only public URL to file.
并且(应下载要求),我仅向用户发送文件的公共URL。 There is a nice tutorial for it in PHP: https://cloud.google.com/appengine/docs/php/googlestorage/user_upload and https://cloud.google.com/appengine/docs/php/googlestorage/public_access and key sentence there: "Once the file is written to Cloud Storage as publically readable, you need to get the public URL for the file, using CloudStorageTools::getPublicUrl."
在PHP中有一个很好的教程: https : //cloud.google.com/appengine/docs/php/googlestorage/user_upload和https://cloud.google.com/appengine/docs/php/googlestorage/public_access和此处的关键句:“一旦将文件以公共可读的方式写入Cloud Storage,则需要使用CloudStorageTools :: getPublicUrl获取文件的公共URL。” How to do the same in python?
如何在python中做同样的事情?
The public URL of a file in GCS looks like this: GCS中文件的公共URL如下所示:
https://storage.googleapis.com/<appname>.appspot.com/<filename>
When I store files in GCS, I explicitly give the file a filename, so I can create a serving URL using the template above. 当我在GCS中存储文件时,我为文件指定了文件名,因此可以使用上面的模板创建服务网址。
Are you giving a filename when you store files in GCS? 在GCS中存储文件时是否要提供文件名? If not, are you able to do so?
如果没有,您能够这样做吗? Maybe provided details of how you are saving the files to GCS in your question to get a better answer.
也许提供了有关如何将文件保存到问题中的GCS的详细信息,以获得更好的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.