ak = os.getenv('TOS_ACCESS_KEY')
sk = os.getenv('TOS_SECRET_KEY')
endpoint = 'Provide your endpoint'
region = 'Provide your region'
vector_bucket_name = 'Provide your bucket name'
account_id = os.getenv('TOS_ACCOUNT_ID')
client = tos.VectorClient(ak, sk, endpoint, region)
result = client.get_vector_bucket(vector_bucket_name, account_id)
print('Query vector bucket information successfully')
print('Request ID: {}'.format(result.request_id))
print('Status codes: {}'.format(result.status_code))
if result.vector_bucket:
print('\n Vector bucket details:')
print('Vector bucket name: {}'.format(result.vector_bucket.vector_bucket_name))
print('Vector bucket TRN: {}'.format(result.vector_bucket.vector_bucket_trn))
print('Creation time: {}'.format(result.vector_bucket.creation_time))
except tos.exceptions.TosClientError as e:
print('fail with client error, message:{}, cause: {}'.format(e.message, e.cause))
except tos.exceptions.TosServerError as e:
print('fail with server error, code: {}'.format(e.code))
print('error with request id: {}'.format(e.request_id))
print('error with message: {}'.format(e.message))
print('error with http code: {}'.format(e.status_code))
print('error with ec: {}'.format(e.ec))
print('error with request url: {}'.format(e.request_url))
print('fail with unknown error: {}'.format(e))