I'm creating a very simple server to pass images to a mobile app. My images
are stored in Google Cloud Storage. I'm new to App Engine in the py3 env,
I've been running a py2.7 app for years. I'm also new to Cloud Storage.
I have a bucket in storage with a bunch of images. I am able to access that
bucket from appengine and iterate over the objects. If I make the bucket's
permissions public I can simply pass the url to my app to display the
images.
Ideally I don't have to make the bucket's permissions public. It seems
there are a couple of options
1) Looks like google.appengine.api.blobstore can create a url:
*blobkey = blobstore.create_gs_key(gs_path) serving_url =
images.get_serving_url(blobkey, secure_url=False)*
Running this I get an error in my logs:
*AssertionError: No api proxy found for service "blobstore"*
If I create the *BlobKey* directly and pass that to the images function I
get
*AssertionError: No api proxy found for service "images"*
2) Looks like theres a way to generate a url that times out after a
certain period of time:
*blobs = storage_client.list_blobs(bucket_name, prefix=myPrefix,
delimiter=None)*
*for blob in blobs:*
* exp = datetime.timedelta(minutes=15)*
* blob.generate_signed_url(version="v4",expiration=**exp*
*,method="GET")*
Running that I get a diff error:
*AttributeError: you need a private key to sign credentials.the credentials
you are currently using <class
'google.auth.compute_engine.credentials.Credentials'> just contains a
token. see
https://googleapis.dev/python/google-api-core/latest/auth.html#setting-up-a-service-account
for more details.*
I've found others with the *no api proxy error* and it seems in all those
cases it's when people are trying to use these api's outside of the
AppEngine Environment. But I am running it within an AppEngine app so those
posts aren't helpful.
My *requirements.txt* is:
Flask==2.0.1
urlfetch
googleapis_common_protos
appengine-python-standard
google-cloud-ndb
google-cloud-logging
google-cloud-storage
Any advice would be helpful, been banging my head on this for several hours.
Thanks!
Daniel
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/961fa55c-a0d7-4cbb-8486-61be6c0f00f3n%40googlegroups.com.