def GenerateBlobKey(time_func=time.time, random_func=random.random):
 timestamp = str(time_func())
 tries = 0
 while (tries < 10):
  number = str(random_func())
  digester = hashlib.md5()
  digester.update(timestamp)
  digester.update(number)
  blob_key = base64.urlsafe_b64encode(digester.digest())
  datastore_key = datastore.Key.from_path(blobstore.BLOB_INFO_KIND, blob_key, namespace='')
  try:
   datastore.Get(datastore_key)
   tries += 1
  except datastore_errors.EntityNotFoundError:
   return blob_key
 return None

def GenerateBlobKey ( time_func = time . time , random_func = random . random ) : timestamp = str ( time_func ( ) ) tries = 0 while ( tries < 10 ) : number = str ( random_func ( ) ) digester = hashlib . md5 ( ) digester . update ( timestamp ) digester . update ( number ) blob_key = base64 . urlsafe_b64encode ( digester . digest ( ) ) datastore_key = datastore . Key . from_path ( blobstore . BLOB_INFO_KIND , blob_key , namespace = '' ) try : datastore . Get ( datastore_key ) tries += 1 except datastore_errors . EntityNotFoundError : return blob_key return None
generate a unique blobkey .