I have a python App Engine app and save files using the Google Cloud Storage API. However I need to get the serving URL for each file.
On production it is easy to figure out what the serving URL is as I prepend http://commondatastorage.googleapis.com
to /bucket/path/to/file.txt
as I already have the bucket name and path to my file.
How do I figure out what the serving URL is on the dev server?
It seems straight forward enough to do this with images using images.get_serving_url
which can now take either blobstore or Cloud Storage references.
How can I figure out the serving URL for all files, not just images in a way that is compatible with both the development and production App Engine environments?
Options for generating a signed URL Simply specify Cloud Storage resources, point to the host storage.googleapis.com , and use Google HMAC credentials in the process of generating the signed URL.
All requests to the storage.cloud.google.com URI require authentication.
Uploading files to Google Cloud Storage from a URL is possible, but there are a few things to keep in mind. First, you'll need to create a Google Cloud Storage bucket and give it a name. Next, you'll need to create a file object in the bucket and provide the URL of the file you want to upload.
You can use GCS via the blobstore API. See this section for how to set up a serving handler for a GCS key:
https://developers.google.com/appengine/docs/python/blobstore/#Python_Using_the_Blobstore_API_with_Google_Cloud_Storage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With