Skip to main content
def get_object_info(
    gcs_uri: str,
    *,
    api_key: Optional[str] = None,
) -> dict:

source code

Get metadata about a GCS object without downloading its content.Retrieves the content type and size of a Google Cloud Storage object. Arguments:
  • gcs_uri - The GCS URI of the object (e.g., “gs://bucket-name/path/to/object”).
  • api_key - If specified, unify API key to be used. Defaults to the value
Returns: A dictionary containing:
  • content_type: The MIME type of the object (or None if not set).
  • size_bytes: The size of the object in bytes.
Raises:
  • RequestError: If the request fails (e.g., object not found, invalid URI).