创建TsdbClient
所有文档

          时序时空数据库 TSDB

          创建TsdbClient

          TSDB的数据接口在Python SDK中通过TsdbClient对象来访问,用户可以参考如下代码新建一个TsdbClient:

          import baidubce.protocol
          from baidubce.bce_client_configuration import BceClientConfiguration
          from baidubce.auth.bce_credentials import BceCredentials
          from baidubce.services.tsdb.tsdb_client import TsdbClient
          # when use https as the protocol, you may find certificate expire problem, this can be resovled by adding the following lines
          # import ssl
          # ssl._create_default_https_context = ssl._create_unverified_context 
           
          ##########必填配置#############
          HOST = 'Fill host here' # 用户的时序数据库域名,形式如databasename.tsdb.iot.gz.baidubce.com
          AK = 'Fill AK here'     # 用户的百度智能云 Access Key ID
          SK = 'Fill SK here'     # 用户的百度智能云 Secret Access Key
           
          ###########可选配置#############
          #使用HTTP协议
          protocol=baidubce.protocol.HTTP
          #使用HTTPS协议
          # protocol= baidubce.protocol.HTTPS
          connection_timeout_in_mills=None  #连接超时时间
          send_buf_size=None                #发送缓冲区大小
          recv_buf_size=None                #接收缓冲区大小
          retry_policy=None                 #重试策略
           
          #生成config对象
          config = BceClientConfiguration(
                  credentials=BceCredentials(AK, SK),
                  endpoint=HOST,
                  protocol=protocol,
                  connection_timeout_in_mills=connection_timeout_in_mills,
                  send_buf_size=send_buf_size,
                  recv_buf_size=recv_buf_size,
                  retry_policy=retry_policy)
           
          #创建TsdbCient
          tsdb__client = TsdbClient(config)
          上一篇
          Demo工程下载
          下一篇
          写入操作