- Documentation
File Storage vePFS
SDK Reference
Python SDK
Initialize the client
Python SDK
Initialize the client
Initialize the client
The vePFS Python client for file storage provides a set of interfaces to interact with the vePFS file storage service and manage resources. You need to initialize the Python client before sending HTTP/HTTPS requests to the vePFS file storage service. This article explains how to initialize the vePFS Python client for file storage.
Prerequisites
- The vePFS Python SDK for file storage has been downloaded and installed. For detailed steps, see Download and Install SDK.
- You need to provide the following information when initializing the client:
- The account's Access Key ID (AK) and Secret Access Key (SK). For methods to obtain AKSK information, see View AKSK Information.
- Region information. For regions supported by vePFS file storage, see Service Address.
Configure environment variables
Hardcoding AccessKey in business code poses certain security risks. We recommend managing AccessKey by configuring environment variables.
- Linux / macOS operating system
- The method for configuring environment variables is as follows:
export VOLCENGINE_ACCESS_KEY_ID=<Your AccessKey ID>
export VOLCENGINE_ACCESS_KEY_SECRET=<Your AccessKey Secret>
- Windows operating system
- The method for configuring environment variables is as follows:
- Create a new environment variable file, add the variables VOLCENGINE_ACCESS_KEY_ID and VOLCENGINE_ACCESS_KEY_SECRET, and enter your AccessKey ID and AccessKey Secret.
- Restart the Windows system.
Initialize the client
Use the following code to initialize the client.
import volcenginesdkvepfs
import volcenginesdkcore
from volcenginesdkcore.rest import ApiException
if __name__ == "__main__":
configuration = volcenginesdkcore.Configuration()
configuration.ak = os.getenv("VOLCENGINE_ACCESS_KEY_ID")
configuration.sk = os.getenv("VOLCENGINE_ACCESS_KEY_SECRET")
configuration.region = "Your Region"
api_instance = volcenginesdkvepfs.VEPFSApi(volcenginesdkcore.ApiClient(configuration))
except ApiException as e:
print("Exception: %s\n" % e)
Last updated: 2026.03.03 10:39:10