{"id":28322,"library":"tencentcloud-sdk-python-afc","title":"Tencent Cloud Afc SDK","description":"Tencent Cloud Afc (Anti-Fraud Cloud) SDK for Python. Provides access to Tencent Cloud's anti-fraud services. Current version: 3.0.1459. Released approximately weekly as part of the Tencent Cloud Python SDK monorepo. Active development.","status":"active","version":"3.0.1459","language":"python","source_language":"en","source_url":"https://github.com/TencentCloud/tencentcloud-sdk-python","tags":["tencentcloud","anti-fraud","sdk","cloud","afc"],"install":[{"cmd":"pip install tencentcloud-sdk-python-afc","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"The SDK uses versioned subpackages. 'afc' alone is ambiguous; the correct import includes the API version (v20200226).","wrong":"from tencentcloud.afc import AfcClient","symbol":"AfcClient","correct":"from tencentcloud.afc.v20200226 import afc_client"},{"note":"Module 'models' is under the versioned path.","wrong":"from tencentcloud.afc import models","symbol":"models","correct":"from tencentcloud.afc.v20200226 import models"}],"quickstart":{"code":"import os\nfrom tencentcloud.common import credential\nfrom tencentcloud.afc.v20200226 import afc_client, models\n\ntry:\n    cred = credential.Credential(\n        os.environ.get('TENCENTCLOUD_SECRET_ID'),\n        os.environ.get('TENCENTCLOUD_SECRET_KEY')\n    )\n    client = afc_client.AfcClient(cred, 'ap-guangzhou')\n    req = models.QueryAntiFraudVipRequest()\n    req.PhoneNumber = '12345678901'\n    resp = client.QueryAntiFraudVip(req)\n    print(resp)\nexcept Exception as e:\n    print(e)","lang":"python","description":"Instantiate the AfcClient with credentials and region, then call QueryAntiFraudVip."},"warnings":[{"fix":"Use the full versioned import path: `from tencentcloud.afc.v20200226 import afc_client, models`","message":"SDK v3 uses versioned subpackages (e.g., v20200226). Older examples may reference 'afc_client' directly under 'tencentcloud.afc' which is incorrect.","severity":"gotcha","affected_versions":">=3.0"},{"fix":"Always pass a region string (e.g., 'ap-guangzhou', 'ap-beijing') to the client constructor.","message":"Region must be specified when creating the client. Default is 'ap-guangzhou'. Some services require a specific region; check Tencent Cloud documentation.","severity":"gotcha","affected_versions":"all"},{"fix":"Instantiate request models with keyword arguments: `req = models.QueryAntiFraudVipRequest(PhoneNumber='12345678901')` instead of dict assignment.","message":"Request and response models changed in v3. v2-style direct dictionary access is deprecated. Use model attributes.","severity":"breaking","affected_versions":">=3.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run: pip install tencentcloud-sdk-python-afc (it depends on the base package automatically)","cause":"Base 'tencentcloud-sdk-python' package not installed.","error":"ModuleNotFoundError: No module named 'tencentcloud'"},{"fix":"Use: from tencentcloud.afc.v20200226 import afc_client","cause":"Incorrect import path; missing versioned subpackage.","error":"AttributeError: module 'tencentcloud.afc' has no attribute 'afc_client'"},{"fix":"Set environment variables TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY, or pass credentials directly.","cause":"Invalid or missing secret ID/secret key.","error":"tencentcloud.common.exception.TencentCloudSDKException: [TencentCloudSDKException] code: AuthFailure.SecretIdNotFound"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}