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'
client = tos.VectorClient(ak, sk, endpoint, region)
result = client.create_vector_bucket(vector_bucket_name)
print('Vector bucket created successfully')
print('Request ID: {}'.format(result.request_id))
print('Status codes: {}'.format(result.status_code))
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))