(self, request, container_name, object_name)
Create or update an object in a container.
Create or update an object in a container.
Create or update an object in a container .
def put_object(self, request, container_name, object_name):
        """
        Create or update an object in a container.
        """
        if container_name in self.containers:
            container = self.containers[container_name]

            def get_header_value(header_key):
                value = request.requestHeaders.getRawHeaders(header_key)
                if value is not None:
                    return value[0].decode("ascii")
                else:
                    return None

            content_type = get_header_value(b"content-type")
            content_encoding = get_header_value(b"content-encoding")
            etag = get_header_value(b"etag")
            object_manifest = get_header_value(b"x-object-manifest")
            object_meta_name = get_header_value(b"x-object-meta-name")

            container.objects[object_name] = Object(
                name=object_name,
                content_encoding=content_encoding,
                content_type=content_type,
                etag=etag,
                object_manifest=object_manifest,
                object_meta_name=object_meta_name,
                data=request.content.read()
            )
            request.setResponseCode(201)
            return b""
        else:
            return NoResource("No such container")
def put_object ( self , request , container_name , object_name ) : if container_name in self . containers : container = self . containers [ container_name ] def get_header_value ( header_key ) : value = request . requestHeaders . getRawHeaders ( header_key ) if value is not None : return value [ 0 ] . decode ( "ascii" ) else : return None content_type = get_header_value ( b"content-type" ) content_encoding = get_header_value ( b"content-encoding" ) etag = get_header_value ( b"etag" ) object_manifest = get_header_value ( b"x-object-manifest" ) object_meta_name = get_header_value ( b"x-object-meta-name" ) container . objects [ object_name ] = Object ( name = object_name , content_encoding = content_encoding , content_type = content_type , etag = etag , object_manifest = object_manifest , object_meta_name = object_meta_name , data = request . content . read ( ) ) request . setResponseCode ( 201 ) return b"" else : return NoResource ( "No such container" )