Reputation: 71
I'm fairly new to GAE and I was wondering how people normally upload images to be stored in Blobstore SPECIFICALLY USING ENDPOINTS. I have seen that there are a lot of examples for apps that don't use endpoints, but nothing for endpoints. My idea was to serialize an image on the client side and send it in a messages.BytesField message to the server to store it in Blobstore. Two questions:
Any help would be appreciated :)
Upvotes: 0
Views: 746
Reputation: 1053
you would have to do something like
import cloudstorage as gcs
with gcs.open('bucketname/filename', 'w') as f:
f.write(blob)
blobkey = blobstore.create_gs_key(gc_object_name='bucketname/filename')
print images.get_serving_url(blobkey)
however be careful when sending large datasets to appengine, it has 32 mb request size limit, 60 seconds deadline when processing, and when reading sent blobs it can take memory and your instance might restart, since they have limited amount of ram based on configuration in console.
Upvotes: 0
Reputation: 80340
It used to be possible to upload files programmatically to Blobstore, but this is now deprecated.
However, you can programmatically upload files to Cloud Storage and then serve them via Blobstore API.
So:
Upvotes: 2