All Products
Search
Document Center

Object Storage Service:Get vector bucket information (Python SDK V2)

Last Updated:Sep 24, 2025

You can use Python SDK V2 to call the GetVectorBucket operation to retrieve information about a vector bucket.

Permissions

Alibaba Cloud accounts have all permissions by default. Resource Access Management (RAM) users and RAM roles do not have any permissions by default. To allow a RAM user or RAM role to perform an operation, an Alibaba Cloud account or an administrator must grant the required permissions using a RAM policy or a bucket policy.

API

Action

Description

GetVectorBucket

oss:GetVectorBucket

Gets information about a vector bucket.

Method definition

get_vector_bucket(request: GetVectorBucketRequest, **kwargs) → GetVectorBucketResult

Request parameters

Parameter

Type

Description

request

GetVectorBucketRequest

The request parameters, such as the name of the vector bucket. For more information, see GetVectorBucketRequest.

Return values

Type

Description

GetVectorBucketResult

The return value. For more information, see GetVectorBucketResult.

For the complete definition of the method, see get_vector_bucket.

Sample code

import argparse
import alibabacloud_oss_v2 as oss
import alibabacloud_oss_v2.vectors as oss_vectors

parser = argparse.ArgumentParser(description="vector get bucket sample")
parser.add_argument('--region', help='The region in which the bucket is located.', required=True)
parser.add_argument('--bucket', help='The name of the bucket.', required=True)
parser.add_argument('--endpoint', help='The domain names that other services can use to access OSS')
parser.add_argument('--account_id', help='The account id.', required=True)

def main():
    args = parser.parse_args()

    # Loading credentials values from the environment variables
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Using the SDK's default configuration
    cfg = oss.config.load_default()
    cfg.credentials_provider = credentials_provider
    cfg.region = args.region
    cfg.account_id = args.account_id
    if args.endpoint is not None:
        cfg.endpoint = args.endpoint

    vector_client = oss_vectors.Client(cfg)

    result = vector_client.get_vector_bucket(oss_vectors.models.GetVectorBucketRequest(
        bucket=args.bucket,
    ))

    print(f'status code: {result.status_code},'
          f' request id: {result.request_id},'
          f' bucket: {result.bucket_info},'
          )



if __name__ == "__main__":
    main()

References

For the complete sample code, see get_vector_bucket.py.