Install & Compatibility
Where this runs
tested against v1.0.223 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.670s · 47.9MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 4.3s · import 0.618s · 49MB
48MB installed
● package 48MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
StsService
✓ from volcengine.sts.StsService import StsService
Import the client for the Security Token Service (STS).
GetCallerIdentityRequest
✓ from volcengine.sts.model.sts_pb2 import GetCallerIdentityRequest
Import specific request models, which are Protocol Buffer messages, from the service's 'model' submodule.
ECSService
✓ from volcengine.ecs.ECSService import ECSService
General pattern for importing a service client, e.g., for Elastic Compute Service (ECS).
This quickstart initializes the Security Token Service (STS) client and calls `GetCallerIdentity` to retrieve the current user's identity. It expects `VOLCENGINE_ACCESSKEYID`, `VOLCENGINE_SECRETACCESSKEY`, and `VOLCENGINE_REGION` to be set as environment variables.
import os
from volcengine.sts.StsService import StsService
from volcengine.sts.model.sts_pb2 import GetCallerIdentityRequest
# Initialize STS service client with credentials from environment variables
sts_service = StsService()
sts_service.set_ak(os.environ.get("VOLCENGINE_ACCESSKEYID", ""))
sts_service.set_sk(os.environ.get("VOLCENGINE_SECRETACCESSKEY", ""))
sts_service.set_region(os.environ.get("VOLCENGINE_REGION", "cn-beijing")) # Default to cn-beijing if not set
# Create a request object
req = GetCallerIdentityRequest()
try:
# Call the API
resp = sts_service.get_caller_identity(req)
# Print the response
print("Successfully called GetCallerIdentity:")
print(f" Account ID: {resp.AccountId}")
print(f" User ID: {resp.UserId}")
print(f" User Name: {resp.UserName}")
except Exception as e:
print(f"Error calling GetCallerIdentity: {e}")
Errors
Common errors & fixes
No module named 'volcengine.ecs.ECSService'
The `volcengine` package or a specific service sub-module is not installed, or the import path is incorrect.
fixEnsure the `volcengine` package is installed via `pip install volcengine`. Verify the exact import path against the official documentation or examples for the specific service you are trying to use.
Status code: 401, Error code: SignatureDoesNotMatch
The provided Volcengine AccessKey ID, Secret Access Key, or Region is incorrect or does not match the request signature.
fixDouble-check the `VOLCENGINE_ACCESSKEYID`, `VOLCENGINE_SECRETACCESSKEY`, and `VOLCENGINE_REGION` environment variables or the values passed to `set_ak()`, `set_sk()`, `set_region()` methods. Ensure they correspond to a valid Volcengine account and region.
AttributeError: 'StsService' object has no attribute 'get_caller_identity'
This usually indicates a typo in the API method name, using an outdated client version, or attempting to call a method that doesn't exist for the service/client.
fixVerify the exact method name and its arguments in the official API documentation for your SDK version. Ensure your SDK is up to date with `pip install --upgrade volcengine`.
Upgrade
Version history
1.0.223latest on PyPI · released May 28, 2026
Audit
Dependencies
requestsrequiredUsed for HTTP communication with Volcengine API endpoints.
protobufrequiredCrucial for serializing and deserializing API requests and responses using Protocol Buffers.
grpciorequiredUnderlying RPC framework used for communication with Volcengine services.
grpcio-toolsrequiredUsed for compiling protobuf definitions, often a runtime dependency for SDKs.