# 简介
欢迎使用腾讯会议开发者工具套件(SDK),为方便 Python 开发者调试和接入腾讯云会议 API,这里向您介绍适用于 Python 的腾讯会议开发工具包,并提供首次使用开发工具包的简单示例。让您快速获取腾讯会议 Python SDK 并开始调用。
# 依赖环境
1. 依赖环境:Python 3.7 版本及以上。
2. 购买腾讯会议企业版获取 SecretID、SecretKey。SecretID 是用于标识 API 调用者的身份,SecretKey 是用于加密签名字符串和服务器端验证签名字符串的密钥 SecretKey 必须严格保管,避免泄露。
# 获取安装
有以下两种方式获取安装。
## 通过pip安装(推荐)
您可以通过 pip 安装方式将腾讯会议 OpenAPI Python SDK 安装到您的项目中。
请在命令行中执行以下命令:
```bash
pip install --upgrade wemeet-openapi-sdk-python
```
请注意,如果同时有 python2 和 python3 环境, python3 环境需要使用 pip3 命令安装。
## 通过源码包安装
1. 前往 [Github 代码托管地址](https://github.com/TencentCloud/wemeet-openapi-sdk-python) 下载源码压缩包;
2. 解压源码包到您项目合适的位置;
3. 使用如下命令安装:
```bash
cd wemeet-openapi-sdk-python
pip install .
```
# 示例
以创建会议接口为例:
```Python
import random
import time
import wemeet_openapi
# create_meeting_demo 创建会议请求demo
def create_meeting_demo():
# 1.构造 client 客户端(jwt 鉴权需要配置 appId sdkId secretID 和 secretKey)
client = wemeet_openapi.Client(app_id="2****46", sdk_id="2****50",
secret_id="Zk*****J8h",
secret_key="Y2z*****WRsVksn")
# 2.构造请求体
request = wemeet_openapi.ApiV1MeetingsPostRequest(
body=wemeet_openapi.V1MeetingsPostRequest(
instanceid=2,
meeting_type=0,
subject="测试会议",
type=1,
userid="userid",
start_time="1651334400",
end_time="1651377600"
)
)
# 3.构造 JWT 鉴权器
authenticator_builder = wemeet_openapi.JWTAuthenticator(
nonce=random.randrange(0, 2 ** 64),
timestamp=str(int(time.time()))
).options_build()
# 4.发送对应的请求
try:
response = client.meetings_api.v1_meetings_post(
request=request,
authenticator_options=[authenticator_builder])
print(f"Response from `MeetingsApi.V1MeetingsPost`: {vars(response)}\n")
except wemeet_openapi.ClientException as e:
print(f"Error when calling `MeetingsApi.V1MeetingsPost`: {e}\n")
except wemeet_openapi.ServiceException as svrErr:
print(f"Error when calling `MeetingsApi.V1MeetingsPost`: {svrErr}\n")
print(f"Full HTTP response: {str(svrErr.api_resp.raw_body)}\n")
# 调用入口点函数
if __name__ == "__main__":
create_meeting_demo()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/TencentCloud/wemeet-openapi-sdk-python",
"name": "wemeet-openapi-sdk-python",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "Wemeet, OpenAPI SDK",
"author": "Wemeet",
"author_email": "wemeet@tencent.com",
"download_url": "https://files.pythonhosted.org/packages/f9/60/e612d87a04ecfb35aed8ced8e56bdd134acf8dd5b41cf8f5a8f71d916899/wemeet-openapi-sdk-python-1.0.3.tar.gz",
"platform": null,
"description": "# \u7b80\u4ecb\n\u6b22\u8fce\u4f7f\u7528\u817e\u8baf\u4f1a\u8bae\u5f00\u53d1\u8005\u5de5\u5177\u5957\u4ef6\uff08SDK\uff09\uff0c\u4e3a\u65b9\u4fbf Python \u5f00\u53d1\u8005\u8c03\u8bd5\u548c\u63a5\u5165\u817e\u8baf\u4e91\u4f1a\u8bae API\uff0c\u8fd9\u91cc\u5411\u60a8\u4ecb\u7ecd\u9002\u7528\u4e8e Python \u7684\u817e\u8baf\u4f1a\u8bae\u5f00\u53d1\u5de5\u5177\u5305\uff0c\u5e76\u63d0\u4f9b\u9996\u6b21\u4f7f\u7528\u5f00\u53d1\u5de5\u5177\u5305\u7684\u7b80\u5355\u793a\u4f8b\u3002\u8ba9\u60a8\u5feb\u901f\u83b7\u53d6\u817e\u8baf\u4f1a\u8bae Python SDK \u5e76\u5f00\u59cb\u8c03\u7528\u3002\n\n# \u4f9d\u8d56\u73af\u5883\n1. \u4f9d\u8d56\u73af\u5883\uff1aPython 3.7 \u7248\u672c\u53ca\u4ee5\u4e0a\u3002\n2. \u8d2d\u4e70\u817e\u8baf\u4f1a\u8bae\u4f01\u4e1a\u7248\u83b7\u53d6 SecretID\u3001SecretKey\u3002SecretID \u662f\u7528\u4e8e\u6807\u8bc6 API \u8c03\u7528\u8005\u7684\u8eab\u4efd\uff0cSecretKey \u662f\u7528\u4e8e\u52a0\u5bc6\u7b7e\u540d\u5b57\u7b26\u4e32\u548c\u670d\u52a1\u5668\u7aef\u9a8c\u8bc1\u7b7e\u540d\u5b57\u7b26\u4e32\u7684\u5bc6\u94a5 SecretKey \u5fc5\u987b\u4e25\u683c\u4fdd\u7ba1\uff0c\u907f\u514d\u6cc4\u9732\u3002\n\n# \u83b7\u53d6\u5b89\u88c5\n\u6709\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u83b7\u53d6\u5b89\u88c5\u3002\n## \u901a\u8fc7pip\u5b89\u88c5\uff08\u63a8\u8350\uff09\n\u60a8\u53ef\u4ee5\u901a\u8fc7 pip \u5b89\u88c5\u65b9\u5f0f\u5c06\u817e\u8baf\u4f1a\u8bae OpenAPI Python SDK \u5b89\u88c5\u5230\u60a8\u7684\u9879\u76ee\u4e2d\u3002\n\u8bf7\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4:\n\n```bash\npip install --upgrade wemeet-openapi-sdk-python\n```\n\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u540c\u65f6\u6709 python2 \u548c python3 \u73af\u5883\uff0c python3 \u73af\u5883\u9700\u8981\u4f7f\u7528 pip3 \u547d\u4ee4\u5b89\u88c5\u3002\n## \u901a\u8fc7\u6e90\u7801\u5305\u5b89\u88c5\n1. \u524d\u5f80 [Github \u4ee3\u7801\u6258\u7ba1\u5730\u5740](https://github.com/TencentCloud/wemeet-openapi-sdk-python) \u4e0b\u8f7d\u6e90\u7801\u538b\u7f29\u5305\uff1b\n2. \u89e3\u538b\u6e90\u7801\u5305\u5230\u60a8\u9879\u76ee\u5408\u9002\u7684\u4f4d\u7f6e\uff1b\n3. \u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a\n```bash\ncd wemeet-openapi-sdk-python\npip install .\n```\n\n# \u793a\u4f8b\n\n\u4ee5\u521b\u5efa\u4f1a\u8bae\u63a5\u53e3\u4e3a\u4f8b\uff1a\n```Python\nimport random\nimport time\n\nimport wemeet_openapi\n\n# create_meeting_demo \u521b\u5efa\u4f1a\u8bae\u8bf7\u6c42demo\ndef create_meeting_demo():\n\n # 1.\u6784\u9020 client \u5ba2\u6237\u7aef(jwt \u9274\u6743\u9700\u8981\u914d\u7f6e appId sdkId secretID \u548c secretKey)\n client = wemeet_openapi.Client(app_id=\"2****46\", sdk_id=\"2****50\",\n secret_id=\"Zk*****J8h\",\n secret_key=\"Y2z*****WRsVksn\")\n\n # 2.\u6784\u9020\u8bf7\u6c42\u4f53\n request = wemeet_openapi.ApiV1MeetingsPostRequest(\n body=wemeet_openapi.V1MeetingsPostRequest(\n instanceid=2,\n meeting_type=0,\n subject=\"\u6d4b\u8bd5\u4f1a\u8bae\",\n type=1,\n userid=\"userid\",\n start_time=\"1651334400\",\n end_time=\"1651377600\"\n )\n )\n\n # 3.\u6784\u9020 JWT \u9274\u6743\u5668\n authenticator_builder = wemeet_openapi.JWTAuthenticator(\n nonce=random.randrange(0, 2 ** 64),\n timestamp=str(int(time.time()))\n ).options_build()\n\n # 4.\u53d1\u9001\u5bf9\u5e94\u7684\u8bf7\u6c42\n try:\n response = client.meetings_api.v1_meetings_post(\n request=request,\n authenticator_options=[authenticator_builder])\n\n print(f\"Response from `MeetingsApi.V1MeetingsPost`: {vars(response)}\\n\")\n except wemeet_openapi.ClientException as e:\n print(f\"Error when calling `MeetingsApi.V1MeetingsPost`: {e}\\n\")\n\n except wemeet_openapi.ServiceException as svrErr:\n print(f\"Error when calling `MeetingsApi.V1MeetingsPost`: {svrErr}\\n\")\n print(f\"Full HTTP response: {str(svrErr.api_resp.raw_body)}\\n\")\n\n\n# \u8c03\u7528\u5165\u53e3\u70b9\u51fd\u6570\nif __name__ == \"__main__\":\n create_meeting_demo()\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "OpenAPI SDK for Python",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/TencentCloud/wemeet-openapi-sdk-python",
"Source": "https://github.com/TencentCloud/wemeet-openapi-sdk-python"
},
"split_keywords": [
"wemeet",
" openapi sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ed70682db1c4386143f201a041fe5f448e74c0998d7e67a8c047c17173eb20ba",
"md5": "1a73043b924c5408249c5636c393e84a",
"sha256": "04a75d657504adff37bc3b22f9d366ecaf1ced48c7a87106d68bf89bf10cc586"
},
"downloads": -1,
"filename": "wemeet_openapi_sdk_python-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1a73043b924c5408249c5636c393e84a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 145531,
"upload_time": "2024-12-03T06:49:43",
"upload_time_iso_8601": "2024-12-03T06:49:43.979154Z",
"url": "https://files.pythonhosted.org/packages/ed/70/682db1c4386143f201a041fe5f448e74c0998d7e67a8c047c17173eb20ba/wemeet_openapi_sdk_python-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f960e612d87a04ecfb35aed8ced8e56bdd134acf8dd5b41cf8f5a8f71d916899",
"md5": "efbf91aea49a1294fa774cc8602cd85e",
"sha256": "b7dbe315479892b53d98b638fc5b90e2aab44ca05967e54fb99f8a004008827e"
},
"downloads": -1,
"filename": "wemeet-openapi-sdk-python-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "efbf91aea49a1294fa774cc8602cd85e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 130066,
"upload_time": "2024-12-03T06:49:46",
"upload_time_iso_8601": "2024-12-03T06:49:46.501124Z",
"url": "https://files.pythonhosted.org/packages/f9/60/e612d87a04ecfb35aed8ced8e56bdd134acf8dd5b41cf8f5a8f71d916899/wemeet-openapi-sdk-python-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-03 06:49:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "TencentCloud",
"github_project": "wemeet-openapi-sdk-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "wemeet-openapi-sdk-python"
}