{"id":34086797,"url":"https://github.com/devmiek/tencent-cloud-sdk-python","last_synced_at":"2026-04-09T18:25:59.059Z","repository":{"id":57474040,"uuid":"238631719","full_name":"devmiek/tencent-cloud-sdk-python","owner":"devmiek","description":"A simple, efficient and easy to use Tencent Cloud SDK implemented in Python.","archived":false,"fork":false,"pushed_at":"2023-01-16T19:55:39.000Z","size":1260,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T10:23:37.029Z","etag":null,"topics":["python","sdk","sdk-python","serverless","tencent-cloud"],"latest_commit_sha":null,"homepage":"https://cloud.tencent.com/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devmiek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-06T07:30:34.000Z","updated_at":"2022-06-02T08:06:27.000Z","dependencies_parsed_at":"2023-02-10T06:01:15.223Z","dependency_job_id":null,"html_url":"https://github.com/devmiek/tencent-cloud-sdk-python","commit_stats":null,"previous_names":["devmiek/tencent-cloud-sdk-python","nobody-night/tencent-cloud-sdk-python"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/devmiek/tencent-cloud-sdk-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmiek%2Ftencent-cloud-sdk-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmiek%2Ftencent-cloud-sdk-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmiek%2Ftencent-cloud-sdk-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmiek%2Ftencent-cloud-sdk-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devmiek","download_url":"https://codeload.github.com/devmiek/tencent-cloud-sdk-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmiek%2Ftencent-cloud-sdk-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30408513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T22:36:59.286Z","status":"ssl_error","status_checked_at":"2026-03-11T22:36:57.544Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","sdk","sdk-python","serverless","tencent-cloud"],"created_at":"2025-12-14T13:33:22.014Z","updated_at":"2026-04-09T18:25:59.047Z","avatar_url":"https://github.com/devmiek.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tencent Cloud SDK for Python\n\n[![license](https://img.shields.io/github/license/nobody-night/stopwatch-python)](LICENSE)\n[![pypi](https://img.shields.io/pypi/v/tencent-cloud-sdk)](https://pypi.org/project/tencent-cloud-sdk/)\n\nA simple, efficient and easy to use Tencent Cloud SDK implemented in Python.\n\nBy integrating and using the Tencent Cloud SDK for Python, you can achieve fast and secure access to the Tencent Cloud API in an object-oriented programming manner, without having to pay attention to implementation details.\n\n**Features:** Tencent Cloud SDK for Python supports full asynchronous programming.\n\nIt is important to note that you cannot use `asyncio.run` to call asynchronous entry functions. See the [asynchronous programming example code](examples/invoke_cloud_function_async.py) for details.\n\n## Navigation\n- [Homepage](https://github.com/nobody-night/tencent-cloud-sdk-python)\n- [Documentation](https://smallso.gitbook.io/tencent-cloud-sdk/)\n- [Release Notes](https://github.com/nobody-night/tencent-cloud-sdk-python/releases)\n- [License](LICENSE)\n\n## Installation\nWith the Python package manager, you can quickly install the Tencent Cloud SDK for Python.\n\n```bash\npip install tencent-cloud-sdk\n```\n\nIf you want to integrate only the products you need, you can take a subcontracted installation of the Tencent Cloud SDK for Python. First we need to install the base package:\n\n```bash\npip install tencent-cloud-sdk-auth\npip install tencent-cloud-sdk-core\n```\n\nThen install the packages for the required products, such as Serverless Cloud Function:\n\n```bash\npip install tencent-cloud-sdk-serverless-functions\n```\n\n**Tips:** Please note that your uninstallation method should be the same as the installation method, otherwise some packages may not be removed.\n\n## Getting Started\nWith the Tencent Cloud SDK for Python, you can use Tencent Cloud products with Python's object-oriented programming.\n\nCurrently Tencent Cloud SDK for Python supports programmatic use in synchronous and asynchronous ways. Asynchronous way can write applications with better performance. Below we will show you how to use the Tencent Cloud SDK for Python in multiple consecutive code snippets using synchronous programming.\n\n### Serverless Cloud Function\nFor example, Invoke has created a Serverless Cloud Function:\n\n#### Import Package\nFirst, we need to import the packages we use:\n\n```python\nfrom tencent.cloud.core import errors\nfrom tencent.cloud.auth import credentials\nfrom tencent.cloud.serverless import functions\n```\n\n#### Access Credentials\nNext, we need to instantiate an access credential so that Tencent Cloud can determine that you have the right to operate.\n\n```python\naccess_credentials = credentials.Credentials(\n    secret_id = 'AKIDF3sMOAU1pOgkmrKHchX6TZQ1Mo1C5qa7',\n    secret_key = 'b4JL8fwxkIgsKMXGi39yYt0ECxZw4wZf'\n)\n```\n\nThe `secret_id` and `secret_key` given in the sample code above are demo credentials. You need to go to the [Tencent Cloud Console](https://console.cloud.tencent.com/cam/capi) to obtain credentials for your account.\n\n##### Environmental Credentials\nThe best practice is to use environmental credentials. By default, the SDK will automatically search for environment variables named `TENCENTCLOUD_SECRETID` and `TENCENTCLOUD_SECRETKEY`. If you need to customize the name of an environment variable, you must explicitly initialize the `credentials.EnvironmentalCredentials` class.\n\n##### File Credentials\nAlternatively, you can use file credentials. By default, the SDK will automatically search for a credentials file named `credentials.json` in the `.`, `./.tencent` and `~/.tencent` directories. The credentials file contains 2 attributes, `secretId` and `secretKey`. If you need to customize the path to the credentials file, you must explicitly initialize the `credentials.FileCredentials` class.\n\nBy default, you do not need to explicitly initialize any credentials, and the relevant parameters should always be set to `None` or ignored.\n\nRemember, please prioritize the use of environmental credentials or file credentials over hard-coded credentials. For more details, please see `credentials.EnvironmentalCredentials` and `credentials.FileCredentials`. \n\n#### Product Client\nThen, we need to instantiate a product client for Serverless Cloud Function:\n\n```python\nfunction_client: functions.Client = functions.Client(\n    access_credentials = access_credentials\n)\n```\n\nThe parameter `credentials_context` is optional. If you use the Tencent Cloud SDK for Python in a Serverless Cloud Function container, this parameter can be ignored or set to `None`.\n\n#### Invoke Cloud Function\nFinally, we try to Invoke a Cloud Function and get the return value. Suppose we have a Cloud Function `hello` in the namespace `default` of the data center `ap-shanghai`:\n\n```python\nreturn_value: str = function_client.easy_invoke(\n    region_id = 'ap-shanghai',  # Unique identifier of the data center\n    namespace_name = 'default', # Name of the namespace\n    function_name = 'hello'     # Name of the Cloud Function\n)\n```\n\nThe local variable `return_value` now has the actual return value of the Cloud Function.\n\nThe method `easy_invoke` will attempt to infer the return value in the given Cloud Function result and return the return value as a Python native data type.\n\n**Tips:** If an error occurs for a given Cloud Function runtime, an `InvokeError` exception is thrown. The above exceptions are defined in the `tencent.cloud.serverless.functions.errors` module.\n\n#### Close product client\nWhen the instantiated client is no longer in use, we should explicitly close it:\n```python\nfunction_client.close()\n```\n\nSee the [examples source code](examples) for the complete demo code.\n\n### Other Tencent Cloud Products\nFor Tencent Cloud products that do not yet provide a product client in the Tencent Cloud SDK, a universal client can be used.\n\n#### Import Packages\nAs with the Serverless Cloud Function product, we need to import the packages we use:\n\n```python\nfrom tencent.cloud.core import errors\nfrom tencent.cloud.core import client\nfrom tencent.cloud.auth import credentials\n```\n\n#### Access Credentials\nAs with the Serverless Cloud Function product, we need to instantiate an access credential. For this paragraph, please refer to the Serverless Cloud Function product getting started demo.\n\n#### Product Client\nSince the Tencent Cloud product we need to use does not provide a product client, we need to instantiate a universal client.\n\nBelow we take Cloud Virtual Machine (CVM) products as an example:\n\n```python\ncvm_client = client.UniversalClient(\n    product_id = 'cvm',     # Unique identifier of the product\n    access_credentials = access_credentials    # Access credentials\n)\n```\n\n#### Use Tencent Cloud API\nFinally, we try to retrieve Zone information operated by a given data center campus, which will use the Tencent Cloud API called [DescribeZones](https://cloud.tencent.com/document/api/213/15707):\n\n```python\naction_result: dict = cvm_client.action(\n    region_id = 'ap-shanghai',      # Unique identifier of the data center\n    action_id = 'DescribeZones',    # Unique identifier of the Tencent Cloud API\n    action_parameters = None,\n    action_version = '2017-03-12'   # Version name of the Tencent Cloud API\n)\n```\n\n**Tips:** If a given Tencent Cloud API encounters an error, an `ActionError` exception is thrown; if the given Tencent Cloud API response is not as expected, an `ActionResultError` exception is thrown. The above exceptions are defined in the `tencent.cloud.core.errors` module.\n\nPrint unique identifiers for all zones:\n\n```python\nfor zone_info in action_result['ZoneSet']:\n    print(zone_info['Zone'])\n```\n\nFor more ways to use Tencent Cloud SDK for Python, see our online documentation. Thank you!\n\n## License\nThe Tencent Cloud SDK for Python is open source using the MIT license, which means that your use is subject to the license, please [view](LICENSE) license details.\n\nIt is worth noting that the Tencent Cloud SDK for Python is using a number of open source dependency packages that are located within a package called `tencent-cloud-sdk-common`. Our use of these dependency packages is governed by the open source license issued with them, and details of the dependency packages can be found at [Common Component Package](https://github.com/nobody-night/tencent-cloud-sdk-python/tree/master/packages/tencent-cloud-sdk-common).\n\n## Other\nIf you encounter any problems during use, you are welcome to navigate to the [Issues](https://github.com/nobody-night/tencent-cloud-sdk-python/issues) page to submit and we will be happy to assist you with the problem.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevmiek%2Ftencent-cloud-sdk-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevmiek%2Ftencent-cloud-sdk-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevmiek%2Ftencent-cloud-sdk-python/lists"}