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