class_docstr: Represent a GCS Object, including all its revisions.
class_docstr_tok: ["Represent","a","GCS","Object",",","including","all","its","revisions","."]
docstr: Insert a new revision based on the give flask request.
  
  :param gcs_url:str the root URL for the fake GCS service.
  :param request:flask.Request the contents of the HTTP request.
  :param resource:dict JSON resource with object metadata.
  :param media_headers:dict media headers in a multi-part upload.
  :param media_body:str object data in a multi-part upload.
  :return: the newly created object version.
  :rtype: GcsObjectVersion
docstr_tok: ["Insert","a","new","revision","based","on","the","give","flask","request",".",":","param","gcs_url",":","str","the","root","URL","for","the","fake","GCS","service",".",":","param","request",":","flask.Request","the","contents","of","the","HTTP","request",".",":","param","resource",":","dict","JSON","resource","with","object","metadata",".",":","param","media_headers",":","dict","media","headers","in","a","multi-part","upload",".",":","param","media_body",":","str","object","data","in","a","multi-part","upload",".",":","return",":","the","newly","created","object","version",".",":","rtype",":","GcsObjectVersion"]
code: def insert_multipart(
      self, gcs_url, request, resource, media_headers, media_body
  ):
      """Insert a new revision based on the give flask request.
  
      :param gcs_url:str the root URL for the fake GCS service.
      :param request:flask.Request the contents of the HTTP request.
      :param resource:dict JSON resource with object metadata.
      :param media_headers:dict media headers in a multi-part upload.
      :param media_body:str object data in a multi-part upload.
      :return: the newly created object version.
      :rtype: GcsObjectVersion
      """
      # There are two ways to specify the content-type, the 'content-type'
      # header and the resource['contentType'] field. They must be consistent,
      # and the service generates an error when they are not.
      if (
          resource.get("contentType") is not None
          and media_headers.get("content-type") is not None
          and resource.get("contentType")
          != media_headers.get("content-type")
      ):
          raise error_response.ErrorResponse(
              (
                  "Content-Type specified in the upload (%s) does not match"
                  + "contentType specified in the metadata (%s)."
              )
              % (
                  media_headers.get("content-type"),
                  resource.get("contentType"),
              ),
              status_code=400,
          )
      # Set the contentType in the resource from the header. Note that if both
      # are set they have the same value.
      resource.setdefault(
          "contentType", media_headers.get("content-type")
      )
      self.generation_generator += 1
      revision = GcsObjectVersion(
          gcs_url,
          self.bucket_name,
          self.name,
          self.generation_generator,
          request,
          media_body,
      )
      meta = revision.metadata.setdefault("metadata", {})
      meta["x_testbench_upload"] = "multipart"
      if "md5Hash" in resource:
          # We should return `x_testbench_md5` only when the user enables
          # `MD5Hash` computations.
          meta["x_testbench_md5"] = resource.get("md5Hash")
      meta["x_testbench_crc32c"] = resource.get("crc32c", "")
      # Apply any overrides from the resource object part.
      revision.update_from_metadata(resource)
      self._insert_revision(revision)
      return revision
  
imports: import base64
  import crc32c
  import error_response
  import hashlib
  import json
  import struct
  import testbench_utils
  import time
label_desc: Use image node_id 11 for calling the GcsObject obj's underlying member method code with example usage: obj.insert_multipart(gcs_url, request, resource, media_headers, media_body) and returns: revision