{"id":28375,"library":"tencentcloud-sdk-python-vpc","title":"TencentCloud SDK Python VPC","description":"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.","status":"active","version":"3.1.82","language":"python","source_language":"en","source_url":"https://github.com/TencentCloud/tencentcloud-sdk-python","tags":["tencentcloud","vpc","cloud-sdk","networking","virtual-private-cloud"],"install":[{"cmd":"pip install tencentcloud-sdk-python-vpc","lang":"bash","label":"Install VPC SDK"},{"cmd":"pip install tencentcloud-sdk-python-vpc==3.1.82","lang":"bash","label":"Install specific version"}],"dependencies":[{"reason":"Core SDK required for credentials and HTTP transport","package":"tencentcloud-sdk-python-common","optional":false}],"imports":[{"note":"Old path missing API version; correct import includes 'v20170312' subpackage.","wrong":"from tencentcloud.vpc.vpc_client import VpcClient","symbol":"VpcClient","correct":"from tencentcloud.vpc.v20170312 import vpc_client"},{"note":"Must specify version in import to access request/response models.","wrong":"from tencentcloud.vpc import models","symbol":"models","correct":"from tencentcloud.vpc.v20170312 import models"}],"quickstart":{"code":"import os\nfrom tencentcloud.common import credential\nfrom tencentcloud.vpc.v20170312 import vpc_client, models\n\ntry:\n    cred = credential.Credential(\n        secret_id=os.environ.get('TENCENTCLOUD_SECRET_ID', ''),\n        secret_key=os.environ.get('TENCENTCLOUD_SECRET_KEY', '')\n    )\n    client = vpc_client.VpcClient(cred, \"ap-guangzhou\")\n    req = models.DescribeVpcsRequest()\n    resp = client.DescribeVpcs(req)\n    print(resp)\nexcept Exception as e:\n    print(f\"Error: {e}\")","lang":"python","description":"Initialize VPC client using environment credentials and list all VPCs."},"warnings":[{"fix":"Update all imports to include API version in path.","message":"Migrating from SDK version <3.0 requires import path change: 'tencentcloud.vpc.v20170312' instead of 'tencentcloud.vpc'","severity":"breaking","affected_versions":"<3.0"},{"fix":"Check API docs for current model names; use 'models.<Action>Request'.","message":"Model class names changed; e.g., 'DescribeVpcsRequest' instead of 'DescribeVpcsReq'","severity":"breaking","affected_versions":"<3.0"},{"fix":"Create a new client per thread or use threading.Lock.","message":"VpcClient is not thread-safe; do not share across threads without locking.","severity":"gotcha","affected_versions":"all"},{"fix":"Pass region to VpcClient constructor; cannot change region per call.","message":"Region parameter must be set during client initialization, not per request.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace with: 'cred = credential.Credential(secret_id, secret_key)'","message":"Use of 'credential.DefaultCredentialProvider' deprecated in favor of explicit 'credential.Credential'","severity":"deprecated","affected_versions":">=3.1.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use: from tencentcloud.vpc.v20170312 import vpc_client","cause":"Missing API version in import path.","error":"ImportError: cannot import name 'VpcClient' from 'tencentcloud.vpc'"},{"fix":"Ensure using correct version subpackage: tencentcloud.vpc.v20170312","cause":"Incorrect API version or action name; often due to wrong import path.","error":"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"},{"fix":"Add: from tencentcloud.vpc.v20170312 import models","cause":"Missing 'models' import; need to import explicitly.","error":"AttributeError: module 'tencentcloud.vpc.v20170312' has no attribute 'models'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}