全部产品
云市场

Python SDK ListTable示例

更新时间:2017-12-06 16:13:54

ListTable代码示例

  1. # -- coding: utf8 --
  2. import time
  3. import logging
  4. import unittest
  5. from ots2 import *
  6. ENDPOINT = https://xxx.cn-hangzhou.ots.aliyuncs.com“;
  7. ACCESSID = xxx”;
  8. ACCESSKEY = xxx”;
  9. INSTANCENAME = xxx”;
  10. ots_client = OTSClient(ENDPOINT, ACCESSID, ACCESSKEY, INSTANCENAME)
  11. list_response = ots_client.list_table()
  12. print uinstance table:’
  13. for table_name in list_response:
  14. print table_name

说明: Python SDK的安装和操作,请参见Python SDK文档

Python SDK文档中没有import的提示,如果不加import的话会出现如下提示:

  1. Traceback (most recent call last):
  2. File listtable.py”, line 6, in
  3. ots_client = OTSClient(ENDPOINT, ACCESSID, ACCESSKEY, INSTANCENAME)
  4. NameError: name OTSClient is not defined

添加import运行即可:

添加import运行