Ikai, is there any way of doing this asynchronously (like URLFetch fetch()
calls)?
Eg: (copied mostly from
http://code.google.com/appengine/docs/python/urlfetch/asynchronousrequests.html
)
from google.appengine.api import images
# ...
blob_keys = [..., ..., ..]
blob_key_serving_urls = []
size = ...
crop = ...
def handle_result(rpc):
url = rpc.get_result()
blob_key_serving_urls.append(url)
# Use a helper function to define the scope of the callback.
def create_callback(rpc):
return lambda: handle_result(rpc)
rpcs = []
for blob_key in blob_keys:
images.create_rpc()
rpc.callback = create_callback(rpc)
images.make_get_serving_url_call(rpc, blob_key, size, crop)
rpcs.append(rpc)
# ...
for rpc in rpcs:
rpc.wait()
# blob_key_serving_urls should now contain the serving URLs.
Or should we add this as a feature request?
Nick
On 27 August 2010 10:56, Ikai L (Google) ika...@google.com wrote:
Yes, you can cache the result. In practice, subsequent calls of
get_serving_url on the same blob should be faster, but if you have more new
blobs than old ones on a page it can be slow. The resulting URL only becomes
invalid if the blob is deleted.
On Tue, Aug 24, 2010 at 1:53 PM, Flips p...@script-network.com wrote:
Hi,
how do I use get_serving_url correctly if I'd like to host a gallery
of 28 pictures? I currently fetch all blob_keys and call 28 times the
get_serving_url method to get my image urls. But this attempt is
really slow (about 12 seconds). Would it be smarter to call
get_serving_url if the blob has been created and store the image url
in datastore?
Best Regards
Philip
--
You received this message because you are subscribed to the Google Groups
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to
google-appengine+unsubscr...@googlegroups.comgoogle-appengine%2bunsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.
--
Ikai Lan
Developer Programs Engineer, Google App Engine
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine
--
You received this message because you are subscribed to the Google Groups
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to
google-appengine+unsubscr...@googlegroups.comgoogle-appengine%2bunsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.
--
You received this message because you are subscribed to the Google Groups
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.