Skip to content

get_object async

get_object(
    path: PathNaming,
    *,
    config_overrides: Optional[AsyncMediaStoreDataClientConfig] = None,
    range: Optional[RangePattern] = None,
) -> AsyncGenerator[GetObjectResponse]

Downloads the object at the specified path. If the object’s upload availability is set to streaming, AWS Elemental MediaStore downloads the object even if it’s still uploading the object.

Parameters:

  • path (PathNaming) –

    The path (including the file name) where the object is stored in the container. Format: //

    For example, to upload the file mlaw.avi to the folder path premium\canada in the container movies, enter the path premium/canada/mlaw.avi.

    Do not include the container name in this path.

    If the path includes any folders that don't exist yet, the service creates them. For example, suppose you have an existing premium/usa subfolder. If you specify premium/canada, the service creates a canada subfolder in the premium folder. You then have two subfolders, usa and canada, in the premium folder.

    There is no correlation between the path to the source and the path (folders) in the container in AWS Elemental MediaStore.

    For more information about folders and how they exist in a container, see the AWS Elemental MediaStore User Guide.

    The file name is the name that is assigned to the file that you upload. The file can have the same name inside and outside of AWS Elemental MediaStore, or it can have the same name. The file name can include or omit an extension.

  • range (Optional[RangePattern], default: None ) –

    The range bytes of an object to retrieve. For more information about the Range header, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35. AWS Elemental MediaStore ignores this header for partially uploaded objects that have streaming upload availability.

Raises:

Source code in docs_src/capo_mediastore_data/_services/async_media_store_data.py
@asynccontextmanager
async def get_object(
    self,
    path: "capo_mediastore_data.types.path_naming.PathNaming",
    *,
    config_overrides: Optional[AsyncMediaStoreDataClientConfig] = None,
    range: Optional["capo_mediastore_data.types.range_pattern.RangePattern"] = None,
) -> "AsyncGenerator[capo_mediastore_data.types.get_object_response.GetObjectResponse]":
    r"""<p>Downloads the object at the specified path. If the object’s upload availability is set to <code>streaming</code>, AWS Elemental MediaStore downloads the object even if it’s still uploading the object.</p>

    Args:
        path: <p>The path (including the file name) where the object is stored in the container. Format: <folder name>/<folder name>/<file name></p> <p>For example, to upload the file <code>mlaw.avi</code> to the folder path <code>premium\canada</code> in the container <code>movies</code>, enter the path <code>premium/canada/mlaw.avi</code>.</p> <p>Do not include the container name in this path.</p> <p>If the path includes any folders that don't exist yet, the service creates them. For example, suppose you have an existing <code>premium/usa</code> subfolder. If you specify <code>premium/canada</code>, the service creates a <code>canada</code> subfolder in the <code>premium</code> folder. You then have two subfolders, <code>usa</code> and <code>canada</code>, in the <code>premium</code> folder. </p> <p>There is no correlation between the path to the source and the path (folders) in the container in AWS Elemental MediaStore.</p> <p>For more information about folders and how they exist in a container, see the <a href="http://docs.aws.amazon.com/mediastore/latest/ug/">AWS Elemental MediaStore User Guide</a>.</p> <p>The file name is the name that is assigned to the file that you upload. The file can have the same name inside and outside of AWS Elemental MediaStore, or it can have the same name. The file name can include or omit an extension. </p>
        range: <p>The range bytes of an object to retrieve. For more information about the <code>Range</code> header, see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35</a>. AWS Elemental MediaStore ignores this header for partially uploaded objects that have streaming upload availability.</p>

    Raises:
        capo_mediastore_data.errors.container_not_found_exception.ContainerNotFoundException: <p>The specified container was not found for the specified account.</p>
        capo_mediastore_data.errors.internal_server_error.InternalServerError: <p>The service is temporarily unavailable.</p>
        capo_mediastore_data.errors.object_not_found_exception.ObjectNotFoundException: <p>Could not perform an operation on an object that does not exist.</p>
        capo_mediastore_data.errors.requested_range_not_satisfiable_exception.RequestedRangeNotSatisfiableException: <p>The requested content range is not valid.</p>
        capo_mediastore_data.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_mediastore_data.types.get_object_request.GetObjectRequest]",
    ) -> AsyncOperationResponse[
        "capo_mediastore_data.types.get_object_response.GetObjectResponse"
    ]:
        import capo_mediastore_data._operations.media_store_object_20170901.get_object

        (
            output,
            http_response,
        ) = await capo_mediastore_data._operations.media_store_object_20170901.get_object.async_get_object(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_mediastore_data.types.get_object_response.GetObjectResponse",
    ) -> dict[str, Any]:
        import capo_mediastore_data.types.get_object_response

        return capo_mediastore_data.types.get_object_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetObject", redact_output=_redact_output),
    )
    input_: capo_mediastore_data.types.get_object_request.GetObjectRequest = {
        "path": path
    }
    if range is not None:
        input_["range"] = range

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    try:
        yield response.output
    finally:
        await response.response.aclose()