class_docstr: Represent a GCS Bucket.
docstr: Capture the details for a resumable upload.
  
  :param upload_url: str the base URL for uploads.
  :param request: flask.Request the original http request.
  :return: the HTTP response to send back.
docstr_tok: ["Capture","the","details","for","a","resumable","upload",".",":","param","upload_url",":","str","the","base","URL","for","uploads",".",":","param","request",":","flask.Request","the","original","http","request",".",":","return",":","the","HTTP","response","to","send","back","."]
code: def create_resumable_upload(self, upload_url, request):
      """Capture the details for a resumable upload.
  
      :param upload_url: str the base URL for uploads.
      :param request: flask.Request the original http request.
      :return: the HTTP response to send back.
      """
      x_upload_content_type = request.headers.get(
          "x-upload-content-type", "application/octet-stream"
      )
      x_upload_content_length = request.headers.get(
          "x-upload-content-length"
      )
      expected_bytes = None
      if x_upload_content_length:
          expected_bytes = int(x_upload_content_length)
  
      if request.args.get("name") is not None and len(request.data):
          raise error_response.ErrorResponse(
              "The name argument is only supported for empty payloads",
              status_code=400,
          )
      if len(request.data):
          metadata = json.loads(request.data)
      else:
          metadata = {"name": request.args.get("name")}
  
      if metadata.get("name") is None:
          raise error_response.ErrorResponse(
              "Missing object name argument", status_code=400
          )
      metadata.setdefault("contentType", x_upload_content_type)
      upload = {
          "metadata": metadata,
          "instructions": request.headers.get(
              "x-goog-testbench-instructions"
          ),
          "fields": request.args.get("fields"),
          "next_byte": 0,
          "expected_bytes": expected_bytes,
          "object_name": metadata.get("name"),
          "media": b"",
          "transfer": set(),
          "done": False,
      }
      # Capture the preconditions, including those that are None.
      for precondition in [
          "ifGenerationMatch",
          "ifGenerationNotMatch",
          "ifMetagenerationMatch",
          "ifMetagenerationNotMatch",
      ]:
          upload[precondition] = request.args.get(precondition)
      upload_id = base64.b64encode(
          bytearray(metadata.get("name"), "utf-8")
      ).decode("utf-8")
      self.resumable_uploads[upload_id] = upload
      location = (
          f"{upload_url}?uploadType=resumable&upload_id={upload_id}"
      )
      response = flask.make_response("")
      response.headers["Location"] = location
      return response
  
file_path: io/tests/test_gcloud/testbench/gcs_bucket.py
imports: import base64
  import error_response
  import flask
  import gcs_object
  import json
  import re
  import testbench_utils
  import time
label_desc: Use image node_id 4 for calling the GcsBucket obj's underlying member method code with example usage: obj.create_resumable_upload(upload_url, request) and returns: response