Registry / aws / tencentcloud-sdk-python-vpc

tencentcloud-sdk-python-vpc

JSON →
library3.1.82pypypi✓ verified 88d ago

Official Tencent Cloud SDK for the Virtual Private Cloud (VPC) service. Provides a Python client for managing VPC resources such as subnets, route tables, security groups, and VPN connections. Current version 3.1.82, stable release cycle aligned with Tencent Cloud API updates.

pip install tencentcloud-sdk-python-vpc
INSTALL
IMPORT
SIG · TENCENTCLOUD-SDK-P
T
tencentcloud-sdk-python-vpc
awspythonv3.1.82
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

VpcClient
✓ from tencentcloud.vpc.v20170312 import vpc_client
✗ from tencentcloud.vpc.vpc_client import VpcClient
Old path missing API version; correct import includes 'v20170312' subpackage.
models
✓ from tencentcloud.vpc.v20170312 import models
✗ from tencentcloud.vpc import models
Must specify version in import to access request/response models.

Initialize VPC client using environment credentials and list all VPCs.

import os from tencentcloud.common import credential from tencentcloud.vpc.v20170312 import vpc_client, models try: cred = credential.Credential( secret_id=os.environ.get('TENCENTCLOUD_SECRET_ID', ''), secret_key=os.environ.get('TENCENTCLOUD_SECRET_KEY', '') ) client = vpc_client.VpcClient(cred, "ap-guangzhou") req = models.DescribeVpcsRequest() resp = client.DescribeVpcs(req) print(resp) except Exception as e: print(f"Error: {e}")
Debug
Known issues
breakingMigrating from SDK version <3.0 requires import path change: 'tencentcloud.vpc.v20170312' instead of 'tencentcloud.vpc'
fix
Update all imports to include API version in path.
affects: <3.0
breakingModel class names changed; e.g., 'DescribeVpcsRequest' instead of 'DescribeVpcsReq'
fix
Check API docs for current model names; use 'models.<Action>Request'.
affects: <3.0
gotchaVpcClient is not thread-safe; do not share across threads without locking.
fix
Create a new client per thread or use threading.Lock.
affects: all
gotchaRegion parameter must be set during client initialization, not per request.
fix
Pass region to VpcClient constructor; cannot change region per call.
affects: all
deprecatedUse of 'credential.DefaultCredentialProvider' deprecated in favor of explicit 'credential.Credential'
fix
Replace with: 'cred = credential.Credential(secret_id, secret_key)'
affects: >=3.1.0
Errors
Common errors & fixes
ImportError: cannot import name 'VpcClient' from 'tencentcloud.vpc'
Missing API version in import path.
fix
Use: from tencentcloud.vpc.v20170312 import vpc_client
tencentcloud.common.exception.TencentCloudSDKException: [InvalidParameter] The request is not completed as the action is not a valid API action, version: 2017-03-12, action: DescribeVpcs
Incorrect API version or action name; often due to wrong import path.
fix
Ensure using correct version subpackage: tencentcloud.vpc.v20170312
AttributeError: module 'tencentcloud.vpc.v20170312' has no attribute 'models'
Missing 'models' import; need to import explicitly.
fix
Add: from tencentcloud.vpc.v20170312 import models
Upgrade
Version history
3.1.82latest on PyPI · released Apr 20, 2026
Audit
Dependencies
tencentcloud-sdk-python-commonrequiredCore SDK required for credentials and HTTP transport
Agent activity
27 hits · last 30 days
node
26
Resources