BccClient
BccClient is the client for the BCC service, providing developers with various methods to interact with the BCC service, including instances, disks, images, snapshots, security groups, availability zones, and more.
Access BCC via AK/SK
Users can refer to the following code to create BccClient:
1class Sample():
2 def setUp(self):
3 AK = 'your-access-key-id' # User's Access Key ID
4 SK = 'your-secret-access-key' # User's Secret Access Key
5# Initialize a BCCClient
6 config = BceClientConfiguration(credentials=BceCredentials(AK, SK))
7 client = bcc_client.BccClient(config)
In the code above, the variables AK and SK are system-assigned strings that identify users and handle signature verification for BCC access.
Here, AK corresponds to “Access Key ID” in the console, and SK corresponds to “Access Key Secret” in the console. For the method to obtain them, please refer to [Obtaining AK/SK](Reference/Retrieve AK and SK/How to Obtain AKSK.md).
The above method uses the default domain name (Beijing region) as the BCC service address. To use a custom domain, provide the Endpoint parameter.
1AK = 'your-access-key-id' # User's Access Key ID
2 SK = 'your-secret-access-key' # User's Secret Access Key
3 HOST = 'domain-name' # User-specified domain name. For domain selection, refer to the "Region List" below
4# Initialize a BCCClient
5config = BceClientConfiguration(credentials=BceCredentials(AK, SK), endpoint=HOST)
6client = bcc_client.BccClient(config)
Note: The Endpoint parameter must use region-specific domains. If unspecified, it defaults to the Beijing regionhttp://bcc.bj.baidubce.com. BCC supports multi-region option. For details, refer to [Service Domain](BCC/API Reference/Service domain.md).
