Byteplus Python SDK V2

raw JSON →
3.0.43 verified Sat May 09 auth: no python

Official Byteplus (Volcengine) SDK for Python. Current version: 3.0.43, supports Python >=2.7. Frequent releases (every few weeks). Provides client libraries for various Byteplus services like ECS, VPC, IAM, etc.

pip install byteplus-python-sdk-v2
error ModuleNotFoundError: No module named 'byteplus'
cause Package not installed or wrong package name.
fix
Install with 'pip install byteplus-python-sdk-v2' and use import 'byteplus' (not 'byteplus_sdk').
error AttributeError: module 'byteplus' has no attribute 'core'
cause Old SDK v1 installed alongside v2, or import path incorrect.
fix
Uninstall old versions: 'pip uninstall byteplus-sdk' and reinstall v2.
breaking SDK v2 is a complete rewrite. Import paths and class names differ from v1 (e.g., 'AcsClient' instead of 'DefaultAcsClient'). Do not mix v1 and v2 imports.
fix Use 'from byteplus.core import AcsClient' and per-service client modules.
gotcha Some services require explicit region parameter; default region may not work. If API calls fail with 'not found', check region.
fix Always pass 'region' when creating AcsClient.
gotcha The SDK requires Python >=2.7 but supports Python 3. However, some dependencies may be Python 2 only. Always use Python 3.6+ for production.
fix Use Python 3.6+. If using Python 2, be aware of limited support.

Initialize a client and call a simple VPC API.

from byteplus.core import AcsClient
from byteplus.vpc.v20200515 import vpc_client
import os

client = AcsClient(
    ak=os.environ.get('BYTEPLUS_ACCESS_KEY', 'your_ak'),
    sk=os.environ.get('BYTEPLUS_SECRET_KEY', 'your_sk'),
    region='cn-north-1'
)
vpc = vpc_client.VpcClient(client)
response = vpc.describe_vpcs()
print(response)