Trouble using appengine-python-standard image and blob libraries in my py3 app

382 views
Skip to first unread message

Daniel Kramer

unread,
Jun 28, 2022, 1:41:01 PM6/28/22
to Google App Engine
I'm creating a simple server to serve images from a Google Cloud Storage bucket.  It will serve images to a mobile app.  I'm new to Google Cloud Storage and a python3 Appengine server, I've been running a py2.7 server for years.

I am able to create a cloud storage client and query items, that's working. It seems wasteful to download the images to the Appengine server to in-turn send those to my app. Ideally I can provide my app a url to pull from storage directly.  I can do this if I make the bucket publicly accessible but ideally I don't have to do that.

From what I can tell there are a couple of options
1) Use from google.appengine.api import images which has a get_serving_url function which sounds like it's the right thing.  But when I try using it I'm getting and error:
AssertionError: No api proxy found for service "image"

2) Also looks like there's an option to use from google.appengine.api import blobstore and use  blobstore.create_gs_key('/gs' + filename) but I get a similar error:
AssertionError: No api proxy found for service "blobstore"

3) lastly it looks like there's a way to generate a url that times out using blob.generate_signed_url(). When I use that I get:
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.

So far a lot of dead ends. Reading about the no api proxy most people are pointing to users who are not running within the AppEngine environment .. but I am and I think it may be because these api's were originally built for the py2 version of Appengine and I'm attempting to use them in py3? I suppose I could change my app to a py2 app, but that seems like a dead end long term.

Thanks for any pointers!
Daniel

Andres Marquez Rodriguez

unread,
Jun 28, 2022, 5:37:20 PM6/28/22
to Google App Engine

Python 3 does not have the bundled services enabled by default. Did you follow the guidelines (steps)[1] documented on this page?

[1] https://cloud.google.com/appengine/docs/standard/python3/services/access

Reply all
Reply to author
Forward
0 new messages