Skip to main content

OpenAPI SDK for Python

Project description

简介

欢迎使用腾讯会议开发者工具套件(SDK),为方便 Python 开发者调试和接入腾讯云会议 API,这里向您介绍适用于 Python 的腾讯会议开发工具包,并提供首次使用开发工具包的简单示例。让您快速获取腾讯会议 Python SDK 并开始调用。

依赖环境

  1. 依赖环境:Python 3.7 版本及以上。
  2. 购买腾讯会议企业版获取 SecretID、SecretKey。SecretID 是用于标识 API 调用者的身份,SecretKey 是用于加密签名字符串和服务器端验证签名字符串的密钥 SecretKey 必须严格保管,避免泄露。

获取安装

有以下两种方式获取安装。

通过pip安装(推荐)

您可以通过 pip 安装方式将腾讯会议 OpenAPI Python SDK 安装到您的项目中。 请在命令行中执行以下命令:

pip install --upgrade wemeet-openapi-sdk-python

请注意,如果同时有 python2 和 python3 环境, python3 环境需要使用 pip3 命令安装。

通过源码包安装

  1. 前往 Github 代码托管地址 下载源码压缩包;
  2. 解压源码包到您项目合适的位置;
  3. 使用如下命令安装:
cd wemeet-openapi-sdk-python
pip install .

示例

以创建会议接口为例:

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wemeet-openapi-sdk-python-1.0.7.tar.gz (129.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wemeet_openapi_sdk_python-1.0.7-py3-none-any.whl (145.3 kB view details)

Uploaded Python 3

File details

Details for the file wemeet-openapi-sdk-python-1.0.7.tar.gz.

File metadata

File hashes

Hashes for wemeet-openapi-sdk-python-1.0.7.tar.gz
Algorithm Hash digest
SHA256 6b627ccbf5c625e492b7e9f9dbb8efc8e783ad941a535e49cee342ba604be336
MD5 19e274e728ee98b36efd7b38eb9d2f51
BLAKE2b-256 30c7c4ce2cdf10eb446c769031041a9883ed5c18cea30439aed2d2d1767f8610

See more details on using hashes here.

File details

Details for the file wemeet_openapi_sdk_python-1.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for wemeet_openapi_sdk_python-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b091bf301261feeda8095d2243ae7dfc5faded38a2f55b1f78ca1872b6f7962a
MD5 f452cb5f3c68ea3ffc507a201309e74b
BLAKE2b-256 45ab0caa848029dd73f03a93e05ffd4a09c642aba1c47f9465026bb7b9a542e8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page