@db.non_transactional
  def put_continue_creation(self, token, content, content_range,
                            length=None,
                            _upload_filename=None):


    ns = namespace_manager.get_namespace()
    try:
      namespace_manager.set_namespace('')
      gcs_file = _AE_GCSFileInfo_.get_by_key_name(token)
      if not gcs_file:
        raise ValueError('Invalid token', httplib.BAD_REQUEST)
      if gcs_file.next_offset == -1:
        raise ValueError('Received more uploads after file %s '
                         'was finalized.' % gcs_file.filename,
                         httplib.OK)
      if content:
        start, end = content_range
        if len(content) != (end - start + 1):
          raise ValueError('Invalid content range %d-%d' % content_range,
                           httplib.REQUESTED_RANGE_NOT_SATISFIABLE)

        if start > gcs_file.next_offset:
          raise ValueError('Expect start offset %s, got %s' %
                           (gcs_file.next_offset, start),
                           httplib.REQUESTED_RANGE_NOT_SATISFIABLE)

        elif end < gcs_file.next_offset:
          return
        else:

          content = content[gcs_file.next_offset - start:]
          start = gcs_file.next_offset
          blobkey = '%s-%d-%d' % (token, start, end)
          self.blob_storage.StoreBlob(blobkey, StringIO.StringIO(content))
          new_content = _AE_GCSPartialFile_(
              parent=gcs_file,

              key_name='%020d' % start,
              partial_content=blobkey,
              start=start,
              end=end + 1)
          new_content.put()
          gcs_file.next_offset = end + 1
          gcs_file.put()
      if length is not None and length != gcs_file.next_offset:
        raise ValueError(
            'Got finalization request with wrong file length. '
            'Expecting %s, got %s' % (gcs_file.next_offset, length),
            httplib.REQUESTED_RANGE_NOT_SATISFIABLE)
      elif length is not None:
        return self._end_creation(token, _upload_filename)
    finally:
      namespace_manager.set_namespace(ns)
Continue object upload with PUTs.
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/ext/cloudstorage/cloudstorage_stub.py/CloudStorageStub.put_continue_creation