[
  {
    "path": ".gitignore",
    "content": "*.pyc\n\n# twine\ndist/\n\n# tox\n.tox/\nqcloudapi_sdk_python.egg-info/\n\n# pytest, pytest-cov\n.cache/\n.coverage\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: false\n\nmatrix:\n  include:\n    - language: python\n      python: \"2.7\"\n      env: TOXENV=py27\n\n    - language: python\n      python: \"3.5\"\n      env: TOXENV=py35\n\n    - language: python\n      python: \"3.6\"\n      env: TOXENV=py36\n\ninstall:\n  - pip install --upgrade tox\n\nscript: tox -r\n\nafter_success:\n    - tox -r -ecoveralls\n"
  },
  {
    "path": "CHANGELOG.rst",
    "content": "=========\nCHANGELOG\n=========\n\nlatest (now)\n============\n\n2.0.15 (2018-06-15)\n===================\n\n* dynamic module support: Now user can call any product's API which runs on \\*.api.qcloud.com even its module is not listed in SDK.\n\n2.0.14 (2018-04-20)\n===================\n\n* add dc module\n\n2.0.13 (2018-04-16)\n===================\n\n* add ccr module\n\n2.0.12 (2018-03-02)\n===================\n\n* add sts module\n* add emr module\n* add athena module\n* add tbaas module\n* add partners module\n\n2.0.11\n======\n\n* add tmt module\n* add apigateway, batch, cloudaudit, scf module\n\n2.0.10\n======\n\n2017-11-27\n\n* fix bmlb, cns, feecenter module import error\n\n2.0.9\n=====\n\n2017-10-30\n\n* add bgpip module\n\nhistory\n=======\n\n* [2017/9/11] 增加Bmeip和Bmvpc模块\n* [2017/8/28] 业务接口的数组参数或者Object参数，支持以Json方式传入，可参考demo.py\n* [2017/8/21] 兼容python2和python3版本；支持pip安装使用\n* [2017/8/8] 增加Cns模块\n* [2017/8/7] 增加Feecenter模块\n* [2017/7/31] 增加Bmlb模块\n* [2017/7/12] 回滚：不默认传Version参数\n* [2017/5/24] 增加Ccs模块\n* [2017/5/19]设置接口默认Version： Cvm模块新版本API已经上线，通过是否传Version区分新旧版本。SDK默认调用新接口，因此需要增加Version的默认设置。 CvmAPI接口介绍见：https://www.qcloud.com/document/api/213/569\n* [2017/3/1] 增加对HmacSHA1和HmacSHA256签名算法兼容的支持\n* [2016/7/15] 增加Tdsql模块\n* [2016/7/6] 添加Cmem模块\n* [2016/5/24] 添加Cbs、Snapshot和Scaling模块\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright 1999-2017 Tencent Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n"
  },
  {
    "path": "MANIFEST.in",
    "content": "include README.rst\ninclude LICENSE\nrecursive-include QcloudApi *\n"
  },
  {
    "path": "QcloudApi/__init__.py",
    "content": "__version__ = '2.0.15'\n"
  },
  {
    "path": "QcloudApi/common/__init__.py",
    "content": ""
  },
  {
    "path": "QcloudApi/common/api_exception.py",
    "content": "# -*- coding: utf-8 -*-\n\n\nclass ApiExceptionBase(Exception):\n    \"\"\"\n    @type message: string\n    @param message: error describe\n    \"\"\"\n    def __init__(self, message):\n        self.message = message\n\n    def get_info(self):\n        return 'Error Message: %s\\n' % (self.message)\n\n    def __str__(self):\n        return \"ApiExceptionBase  %s\" % (self.get_info())\n\n\nclass ApiClientParamException(ApiExceptionBase):\n    def __init__(self, message):\n        ApiExceptionBase.__init__(self, message)\n\n    def __str__(self):\n        return \"ApiClientException  %s\" % (self.get_info())\n\n\nclass ApiClientNetworkException(ApiExceptionBase):\n    \"\"\" @note: client network exception\n    \"\"\"\n    def __init__(self, message):\n        ApiExceptionBase.__init__(self, message)\n\n    def __str__(self):\n        return \"ApiClientNetworkException  %s\" % (self.get_info())\n\n\nclass ApiServerNetworkException(ApiExceptionBase):\n    \"\"\" @note: api server exception\n    \"\"\"\n    def __init__(self, status=200, header=None, data=\"\"):\n        if header is None:\n            header = {}\n        self.status = status\n        self.header = header\n        self.data = data\n\n    def __str__(self):\n        headers = \"\\n\".join(\"%s: %s\" % (k, v) for k, v in self.header.items())\n        return (\"ApiServerNetworkException Status: %s\\nHeader: %s\\nData: %s\\n\"\n                % (self.status, headers, self.data))\n"
  },
  {
    "path": "QcloudApi/common/request.py",
    "content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport os\nimport socket\ntry:\n    from http.client import HTTPConnection, BadStatusLine, HTTPSConnection\n    from urllib.parse import urlparse\nexcept ImportError:\n    from httplib import HTTPConnection, BadStatusLine, HTTPSConnection\n    from urlparse import urlparse\n\nfrom .api_exception import ApiClientNetworkException, ApiClientParamException\n\n\nclass MyHTTPSConnection(HTTPSConnection):\n    def __init__(self, host, port=None):\n        self.has_proxy = False\n        self.request_host = host\n        https_proxy = (os.environ.get('https_proxy')\n                       or os.environ.get('HTTPS_PROXY'))\n        if https_proxy:\n            url = urlparse(https_proxy)\n            if not url.hostname:\n                url = urlparse('https://' + https_proxy)\n            host = url.hostname\n            port = url.port\n            self.has_proxy = True\n        HTTPSConnection.__init__(self, host, port)\n        self.request_length = 0\n\n    def send(self, astr):\n        HTTPSConnection.send(self, astr)\n        self.request_length += len(astr)\n\n    def request(self, method, url, body=None, headers={}):\n        self.request_length = 0\n        if self.has_proxy:\n            self.set_tunnel(self.request_host, 443)\n        HTTPSConnection.request(self, method, url, body, headers)\n\n\nclass ApiRequest(object):\n    def __init__(self, host, req_timeout=90, debug=False):\n        self.conn = MyHTTPSConnection(host)\n        self.req_timeout = req_timeout\n        self.keep_alive = False\n        self.debug = debug\n        self.request_size = 0\n        self.response_size = 0\n\n    def set_req_timeout(self, req_timeout):\n        self.req_timeout = req_timeout\n\n    def is_keep_alive(self):\n        return self.keep_alive\n\n    def set_debug(self, debug):\n        self.debug = debug\n\n    def send_request(self, req_inter):\n        try:\n            if self.debug:\n                print(\"SendRequest %s\" % req_inter)\n            if req_inter.method == 'GET':\n                req_inter_url = '%s?%s' % (req_inter.uri, req_inter.data)\n                self.conn.request(req_inter.method, req_inter_url,\n                                  None, req_inter.header)\n            elif req_inter.method == 'POST':\n                self.conn.request(req_inter.method, req_inter.uri,\n                                  req_inter.data, req_inter.header)\n            else:\n                raise ApiClientParamException(\n                    'Method only support (GET, POST)')\n\n            self.conn.sock.settimeout(self.req_timeout)\n            self.conn.sock.setsockopt(socket.IPPROTO_TCP,\n                                      socket.TCP_NODELAY, 1)\n            try:\n                http_resp = self.conn.getresponse()\n            except BadStatusLine:\n                # open another connection when keep-alive timeout\n                # httplib will not handle keep-alive timeout,\n                # so we must handle it ourself\n                if self.debug:\n                    print(\"keep-alive timeout, reopen connection\")\n                self.conn.close()\n\n                self.conn.request(req_inter.method, req_inter.uri,\n                                  req_inter.data, req_inter.header)\n                self.conn.sock.settimeout(self.req_timeout)\n                self.conn.sock.setsockopt(socket.IPPROTO_TCP,\n                                          socket.TCP_NODELAY, 1)\n                http_resp = self.conn.getresponse()\n            headers = dict(http_resp.getheaders())\n            resp_inter = ResponseInternal(status=http_resp.status,\n                                          header=headers,\n                                          data=http_resp.read())\n            self.request_size = self.conn.request_length\n            self.response_size = len(resp_inter.data)\n            if not self.is_keep_alive():\n                self.conn.close()\n            if self.debug:\n                print((\"GetResponse %s\" % resp_inter))\n            return resp_inter\n        except Exception as e:\n            self.conn.close()\n            raise ApiClientNetworkException(str(e))\n\n\nclass RequestInternal(object):\n    def __init__(self, host=\"\", method=\"\", uri=\"\", header=None, data=\"\"):\n        if header is None:\n            header = {}\n        self.host = host\n        self.method = method\n        self.uri = uri\n        self.header = header\n        self.data = data\n\n    def __str__(self):\n        headers = \"\\n\".join(\"%s: %s\" % (k, v) for k, v in self.header.items())\n        return (\"Host: %s\\nMethod: %s\\nUri: %s\\nHeader: %s\\nData: %s\\n\"\n                % (self.host, self.method, self.uri, headers, self.data))\n\n\nclass ResponseInternal(object):\n    def __init__(self, status=0, header=None, data=\"\"):\n        if header is None:\n            header = {}\n        self.status = status\n        self.header = header\n        self.data = data\n\n    def __str__(self):\n        headers = \"\\n\".join(\"%s: %s\" % (k, v) for k, v in self.header.items())\n        return (\"Status: %s\\nHeader: %s\\nData: %s\\n\"\n                % (self.status, headers, self.data))\n"
  },
  {
    "path": "QcloudApi/common/sign.py",
    "content": "# -*- coding: utf-8 -*-\n\nimport binascii\nimport hashlib\nimport hmac\nimport sys\n\n\nclass Sign(object):\n    def __init__(self, secretId, secretKey):\n        self.secretId = secretId\n        self.secretKey = secretKey\n        if sys.version_info[0] > 2:\n            self.Py2 = False\n            self.secretKey = bytes(self.secretKey, 'utf-8')\n        else:\n            self.Py2 = True\n\n    def make(self, requestHost, requestUri, params,\n             method='POST', sign_method='HmacSHA1'):\n        p = {}\n        for k in params:\n            if method == 'POST' and str(params[k])[0:1] == '@':\n                continue\n            p[k.replace('_', '.')] = params[k]\n        ps = '&'.join('%s=%s' % (k, p[k]) for k in sorted(p))\n\n        msg = '%s%s%s?%s' % (method.upper(), requestHost, requestUri, ps)\n        if not self.Py2:\n            msg = bytes(msg, 'utf-8')\n\n        if sign_method == 'HmacSHA256':\n            digestmod = hashlib.sha256\n        else:\n            digestmod = hashlib.sha1\n\n        hashed = hmac.new(self.secretKey, msg, digestmod)\n        base64 = binascii.b2a_base64(hashed.digest())[:-1]\n        if not self.Py2:\n            base64 = base64.decode()\n\n        return base64\n"
  },
  {
    "path": "QcloudApi/modules/__init__.py",
    "content": ""
  },
  {
    "path": "QcloudApi/modules/account.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Account(base.Base):\n    requestHost = 'account.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/apigateway.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass APIGateway(base.Base):\n    requestHost = 'apigateway.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/athena.py",
    "content": "# Copyright 1999-2018 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Athena(base.Base):\n    \"\"\"Financial Intelligent Customer Service.\n\n    document: https://cloud.tencent.com/document/product/671\n    \"\"\"\n    requestHost = 'athena.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/base.py",
    "content": "# -*- coding: utf-8 -*-\n#\n# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport copy\nimport time\nimport random\nimport sys\nimport os\nimport warnings\n\ntry:\n    from urllib.parse import urlencode\nexcept ImportError:\n    from urllib import urlencode\n\nimport QcloudApi\nfrom QcloudApi.common.api_exception import ApiClientParamException\nfrom QcloudApi.common.api_exception import ApiServerNetworkException\nfrom QcloudApi.common.request import ApiRequest\nfrom QcloudApi.common.request import RequestInternal\nfrom QcloudApi.common.sign import Sign\n\nwarnings.filterwarnings(\"ignore\")\n\n\nclass Base(object):\n    requestHost = ''\n    requestUri = '/v2/index.php'\n    _params = {}\n    version = 'SDK_PYTHON_%s' % QcloudApi.__version__\n\n    def __init__(self, config):\n        self.secretId = config['secretId']\n        self.secretKey = config['secretKey']\n        self.defaultRegion = config.get('Region', '')\n        self.Version = config.get('Version', '')\n        self.method = config.get('method', 'GET').upper()\n        self.sign_method = config.get('SignatureMethod', 'HmacSHA1')\n        self.requestHost = self.requestHost or config.get(\"endpoint\")\n        self.apiRequest = ApiRequest(self.requestHost)\n        self.Token = config.get('Token', '')\n\n    def set_req_timeout(self, req_timeout):\n        self.apiRequest.set_req_timeout(req_timeout)\n\n    def open_debug(self):\n        self.apiRequest.set_debug(True)\n\n    def close_debug(self):\n        self.apiRequest.set_debug(False)\n\n    def _build_header(self, req):\n        if self.apiRequest.is_keep_alive():\n            req.header[\"Connection\"] = \"Keep-Alive\"\n        if req.method == 'POST':\n            req.header[\"Content-Type\"] = \"application/x-www-form-urlencoded\"\n\n    def _fix_params(self, params):\n        if not isinstance(params, (dict,)):\n            return params\n        return self._format_params(None, params)\n\n    def _format_params(self, prefix, params):\n        d = {}\n        if params is None:\n            return d\n\n        if not isinstance(params, (tuple, list, dict)):\n            d[prefix] = params\n            return d\n\n        if isinstance(params, (list, tuple)):\n            for idx, item in enumerate(params):\n                if prefix:\n                    key = \"{0}.{1}\".format(prefix, idx)\n                else:\n                    key = \"{0}\".format(idx)\n                d.update(self._format_params(key, item))\n            return d\n\n        if isinstance(params, dict):\n            for k, v in params.items():\n                if prefix:\n                    key = '{0}.{1}'.format(prefix, k)\n                else:\n                    key = '{0}'.format(k)\n                d.update(self._format_params(key, v))\n            return d\n\n        raise ApiClientParamException('some params type error')\n\n    def _build_req_inter(self, action, params, req_inter):\n        _params = copy.deepcopy(self._fix_params(params))\n        _params['Action'] = action[0].upper() + action[1:]\n        _params['RequestClient'] = self.version\n\n        if ('Region' not in _params and self.defaultRegion != ''):\n            _params['Region'] = self.defaultRegion\n\n        if ('Version' not in _params and self.Version != ''):\n            _params['Version'] = self.Version\n\n        if ('Token' not in _params and self.Token != ''):\n            _params['Token'] = self.Token\n\n        if ('SecretId' not in _params):\n            _params['SecretId'] = self.secretId\n\n        if ('Nonce' not in _params):\n            _params['Nonce'] = random.randint(1, sys.maxsize)\n\n        if ('Timestamp' not in _params):\n            _params['Timestamp'] = int(time.time())\n\n        if ('SignatureMethod' in _params):\n            self.sign_method = _params['SignatureMethod']\n        else:\n            _params['SignatureMethod'] = self.sign_method\n\n        sign = Sign(self.secretId, self.secretKey)\n        _params['Signature'] = sign.make(\n            req_inter.host, req_inter.uri, _params,\n            req_inter.method, self.sign_method)\n\n        req_inter.data = urlencode(_params)\n\n        self._build_header(req_inter)\n\n    def _check_status(self, resp_inter):\n        if resp_inter.status != 200:\n            raise ApiServerNetworkException(\n                resp_inter.status, resp_inter.header, resp_inter.data)\n\n    def generateUrl(self, action, params):\n        req_inter = RequestInternal(\n            self.requestHost, self.method, self.requestUri)\n        self._build_req_inter(action, params, req_inter)\n        url = 'https://%s%s' % (req_inter.host, req_inter.uri)\n        if (req_inter.method == 'GET'):\n            url += '?' + req_inter.data\n        return url\n\n    def call(self, action, params, files={}):\n        req_inter = RequestInternal(\n            self.requestHost, self.method, self.requestUri)\n        self._build_req_inter(action, params, req_inter)\n        resp_inter = self.apiRequest.send_request(req_inter)\n        self._check_status(resp_inter)\n        return resp_inter.data\n"
  },
  {
    "path": "QcloudApi/modules/batch.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Batch(base.Base):\n    requestHost = 'batch.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/bgpip.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Bgpip(base.Base):\n    requestHost = 'bgpip.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/bill.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Bill(base.Base):\n    requestHost = 'bill.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/bm.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Bm(base.Base):\n    requestHost = 'bm.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/bmeip.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Bmeip(base.Base):\n    requestHost = 'bmeip.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/bmlb.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Bmlb(base.Base):\n    requestHost = 'bmlb.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/bmvpc.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Bmvpc(base.Base):\n    requestHost = 'bmvpc.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/cbs.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Cbs(base.Base):\n    requestHost = 'cbs.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/ccr.py",
    "content": "# Copyright (c) 2018 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Ccr(base.Base):\n    \"\"\"Cloud Container Repository\n\n    document: https://cloud.tencent.com/document/product/457/9427\n    \"\"\"\n    requestHost = 'ccr.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/ccs.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Ccs(base.Base):\n    requestHost = 'ccs.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/cdb.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Cdb(base.Base):\n    requestHost = 'cdb.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/cdn.py",
    "content": "# -*- coding: utf-8 -*-\n# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport hashlib\nimport os\n\nfrom QcloudApi.modules import base\n\n\nclass Cdn(base.Base):\n    requestHost = 'cdn.api.qcloud.com'\n\n    def UploadCdnEntity(self, params):\n        action = 'UploadCdnEntity'\n        if params.get('entityFile') is None:\n            raise ValueError('entityFile can not be empty.')\n        if os.path.isfile(params['entityFile']) is False:\n            raise ValueError('entityFile is not exist.')\n\n        file = params.pop('entityFile')\n        if 'entityFileMd5' not in params:\n            content = open(file, 'rb').read()\n            params['entityFileMd5'] = hashlib.md5(content).hexdigest()\n\n        files = {\n            'entityFile': open(file, 'rb')\n        }\n\n        return self.call(action, params, files)\n"
  },
  {
    "path": "QcloudApi/modules/cloudaudit.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass CloudAudit(base.Base):\n    requestHost = 'cloudaudit.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/cmem.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Cmem(base.Base):\n    requestHost = 'cmem.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/cns.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Cns(base.Base):\n    requestHost = 'cns.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/cvm.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Cvm(base.Base):\n    requestHost = 'cvm.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/dc.py",
    "content": "# -*- coding: utf-8 -*-\n# Copyright (c) 2018 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Dc(base.Base):\n    \"\"\"Tencent Cloud Direct Connect\n\n    document: https://cloud.tencent.com/document/product/216/1711\n    \"\"\"\n    requestHost = 'dc.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/dfw.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Dfw(base.Base):\n    requestHost = 'dfw.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/eip.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Eip(base.Base):\n    requestHost = 'eip.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/emr.py",
    "content": "# Copyright 1999-2018 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Emr(base.Base):\n    \"\"\"Elastic Map Reduce.\n\n    document: https://cloud.tencent.com/document/product/589\n    \"\"\"\n    requestHost = 'emr.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/feecenter.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Feecenter(base.Base):\n    requestHost = 'feecenter.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/image.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Image(base.Base):\n    requestHost = 'image.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/lb.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Lb(base.Base):\n    requestHost = 'lb.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/live.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Live(base.Base):\n    requestHost = 'live.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/market.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Market(base.Base):\n    requestHost = 'market.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/monitor.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Monitor(base.Base):\n    requestHost = 'monitor.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/partners.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Partners(base.Base):\n    requestHost = 'partners.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/redis.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Redis(base.Base):\n    requestHost = 'redis.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/scaling.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Scaling(base.Base):\n    requestHost = 'scaling.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/scf.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Scf(base.Base):\n    \"\"\"Serverless Cloud Function.\"\"\"\n\n    requestHost = 'scf.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/sec.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Sec(base.Base):\n    requestHost = 'csec.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/snapshot.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Snapshot(base.Base):\n    requestHost = 'snapshot.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/sts.py",
    "content": "# Copyright 1999-2018 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Sts(base.Base):\n    \"\"\"Security Token Service.\n\n    document: https://cloud.tencent.com/document/product/598\n    \"\"\"\n    requestHost = 'sts.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/tbaas.py",
    "content": "# Copyright 1999-2018 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Tbaas(base.Base):\n    \"\"\"Tencent Blockchain as a Service.\n\n    document: https://cloud.tencent.com/document/product/663\n    \"\"\"\n    requestHost = 'tbaas.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/tdsql.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Tdsql(base.Base):\n    requestHost = 'tdsql.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/tmt.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Tmt(base.Base):\n    \"\"\"Tencent Machine Translation.\n\n    document: https://cloud.tencent.com/document/product/551\n    \"\"\"\n    requestHost = 'tmt.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/trade.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Trade(base.Base):\n    requestHost = 'trade.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/vod.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Vod(base.Base):\n    requestHost = 'vod.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/vpc.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Vpc(base.Base):\n    requestHost = 'vpc.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/wenzhi.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Wenzhi(base.Base):\n    requestHost = 'wenzhi.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/modules/yunsou.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.modules import base\n\n\nclass Yunsou(base.Base):\n    requestHost = 'yunsou.api.qcloud.com'\n"
  },
  {
    "path": "QcloudApi/qcloudapi.py",
    "content": "#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom QcloudApi.modules import base\n\n\nclass QcloudApi(object):\n    def __init__(self, module, config):\n        self.module = module\n        self.config = config\n\n    def _factory(self, module, config):\n        if (module == 'cdb'):\n            from .modules.cdb import Cdb\n            service = Cdb(config)\n        elif (module == 'account'):\n            from .modules.account import Account\n            service = Account(config)\n        elif (module == 'cvm'):\n            from .modules.cvm import Cvm\n            service = Cvm(config)\n        elif (module == 'image'):\n            from .modules.image import Image\n            service = Image(config)\n        elif (module == 'lb'):\n            from .modules.lb import Lb\n            service = Lb(config)\n        elif (module == 'sec'):\n            from .modules.sec import Sec\n            service = Sec(config)\n        elif (module == 'trade'):\n            from .modules.trade import Trade\n            service = Trade(config)\n        elif (module == 'bill'):\n            from .modules.bill import Bill\n            service = Bill(config)\n        elif (module == 'monitor'):\n            from .modules.monitor import Monitor\n            service = Monitor(config)\n        elif (module == 'cdn'):\n            from .modules.cdn import Cdn\n            service = Cdn(config)\n        elif (module == 'vpc'):\n            from .modules.vpc import Vpc\n            service = Vpc(config)\n        elif (module == 'vod'):\n            from .modules.vod import Vod\n            service = Vod(config)\n        elif (module == 'yunsou'):\n            from .modules.yunsou import Yunsou\n            service = Yunsou(config)\n        elif (module == 'wenzhi'):\n            from .modules.wenzhi import Wenzhi\n            service = Wenzhi(config)\n        elif (module == 'market'):\n            from .modules.market import Market\n            service = Market(config)\n        elif (module == 'live'):\n            from .modules.live import Live\n            service = Live(config)\n        elif (module == 'eip'):\n            from .modules.eip import Eip\n            service = Eip(config)\n        elif (module == 'cbs'):\n            from .modules.cbs import Cbs\n            service = Cbs(config)\n        elif (module == 'snapshot'):\n            from .modules.snapshot import Snapshot\n            service = Snapshot(config)\n        elif (module == 'scaling'):\n            from .modules.scaling import Scaling\n            service = Scaling(config)\n        elif (module == 'cmem'):\n            from .modules.cmem import Cmem\n            service = Cmem(config)\n        elif (module == 'tdsql'):\n            from .modules.tdsql import Tdsql\n            service = Tdsql(config)\n        elif (module == 'bm'):\n            from .modules.bm import Bm\n            service = Bm(config)\n        elif (module == 'bmlb'):\n            from .modules.bmlb import Bmlb\n            service = Bmlb(config)\n        elif (module == 'redis'):\n            from .modules.redis import Redis\n            service = Redis(config)\n        elif (module == 'dfw'):\n            from .modules.dfw import Dfw\n            service = Dfw(config)\n        elif (module == 'ccs'):\n            from .modules.ccs import Ccs\n            service = Ccs(config)\n        elif (module == 'feecenter'):\n            from .modules.feecenter import Feecenter\n            service = Feecenter(config)\n        elif (module == 'cns'):\n            from .modules.cns import Cns\n            service = Cns(config)\n        elif (module == 'bmeip'):\n            from .modules.bmeip import Bmeip\n            service = Bmeip(config)\n        elif (module == 'bmvpc'):\n            from .modules.bmvpc import Bmvpc\n            service = Bmvpc(config)\n        elif module == 'bgpip':\n            from .modules.bgpip import Bgpip\n            service = Bgpip(config)\n        elif module == 'scf':\n            from .modules.scf import Scf\n            service = Scf(config)\n        elif module == 'apigateway':\n            from .modules.apigateway import APIGateway\n            service = APIGateway(config)\n        elif module == 'batch':\n            from .modules.batch import Batch\n            service = Batch(config)\n        elif module == 'cloudaudit':\n            from .modules.cloudaudit import CloudAudit\n            service = CloudAudit(config)\n        elif module == 'tmt':\n            from .modules.tmt import Tmt\n            service = Tmt(config)\n        elif module == 'partners':\n            from .modules.partners import Partners\n            service = Partners(config)\n        elif module == 'tbaas':\n            from .modules.tbaas import Tbaas\n            service = Tbaas(config)\n        elif module == 'athena':\n            from .modules.athena import Athena\n            service = Athena(config)\n        elif module == 'emr':\n            from .modules.emr import Emr\n            service = Emr(config)\n        elif module == 'sts':\n            from .modules.sts import Sts\n            service = Sts(config)\n        elif module == 'ccr':\n            from .modules.ccr import Ccr\n            service = Ccr(config)\n        elif module == 'dc':\n            from .modules.dc import Dc\n            service = Dc(config)\n        else:\n            config.setdefault(\"endpoint\", module + '.api.qcloud.com')\n            service = base.Base(config)\n\n        return service\n\n    def setSecretId(self, secretId):\n        self.config['secretId'] = secretId\n\n    def setSecretKey(self, secretKey):\n        self.config['secretKey'] = secretKey\n\n    def setRequestMethod(self, method):\n        self.config['method'] = method\n\n    def setRegion(self, region):\n        self.config['Region'] = region\n\n    def setSignatureMethod(self, SignatureMethod):\n        self.config['SignatureMethod'] = SignatureMethod\n\n    def generateUrl(self, action, params):\n        service = self._factory(self.module, self.config)\n        return service.generateUrl(action, params)\n\n    def call(self, action, params, req_timeout=None, debug=False):\n        \"\"\"\n        @type action: string\n        @param action: action interface\n\n        @type params: dict\n        @param params: interface parameters\n\n        @type req_timeout: int\n        @param req_timeout: request timeout(seconds)\n\n        @type debug: bool\n        @param debug: debug switch\n        \"\"\"\n        service = self._factory(self.module, self.config)\n        if req_timeout is not None:\n            service.set_req_timeout(req_timeout)\n        if debug:\n            service.open_debug()\n\n        methods = dir(service)\n        for method in methods:\n            if (method == action):\n                func = getattr(service, action)\n                return func(params)\n\n        return service.call(action, params)\n"
  },
  {
    "path": "README.md",
    "content": "[![pypi version](https://img.shields.io/pypi/v/qcloudapi-sdk-python.svg)](https://pypi.python.org/pypi/qcloudapi-sdk-python)\r\n[![Build Status](https://travis-ci.org/QcloudApi/qcloudapi-sdk-python.svg?branch=master)](https://travis-ci.org/QcloudApi/qcloudapi-sdk-python)\r\n[![Coverage Status](https://coveralls.io/repos/github/QcloudApi/qcloudapi-sdk-python/badge.svg?branch=master)](https://coveralls.io/github/QcloudApi/qcloudapi-sdk-python)\r\n\r\n# qcloudapi-sdk-python\r\n\r\nqcloudapi-sdk-python是为了让Python开发者能够在自己的代码里更快捷方便的使用腾讯云的API而开发的SDK工具包。\r\n\r\n## 资源\r\n\r\n* [公共参数](https://www.qcloud.com/document/api/213/6976)\r\n* [API列表](https://www.qcloud.com/document/api)\r\n* [错误码](https://www.qcloud.com/document/api/213/10146)\r\n\r\n## 入门\r\n\r\n1. 申请[安全凭证](https://console.qcloud.com/capi)。\r\n在第一次使用云API之前，用户首先需要在腾讯云网站上申请安全凭证，安全凭证包括 SecretId 和 SecretKey, SecretId 是用于标识 API 调用者的身份，SecretKey是用于加密签名字符串和服务器端验证签名字符串的密钥。SecretKey 必须严格保管，避免泄露。\r\n\r\n## 安装\r\n\r\n    $ pip install qcloudapi-sdk-python\r\n\r\n或者下载源码安装\r\n\r\n    $ git clone https://github.com/QcloudApi/qcloudapi-sdk-python\r\n    $ cd qcloudapi-sdk-python\r\n    $ python setup.py install\r\n\r\n## 示例\r\n\r\n```python\r\n# -*- coding: utf8 -*-\r\nfrom QcloudApi.qcloudapi import QcloudApi\r\n\r\n# 设置需要加载的模块\r\nmodule = 'cvm'\r\n\r\n# 对应接口的接口名，请参考wiki文档上对应接口的接口名\r\naction = 'DescribeInstances'\r\n\r\n# 云API的公共参数\r\nconfig = {\r\n    'Region': 'ap-guangzhou',\r\n    'secretId': '您的secretId',\r\n    'secretKey': '您的secretKey',\r\n    'method': 'GET',\r\n    'SignatureMethod': 'HmacSHA1',\r\n    # 只有cvm需要填写version，其他产品不需要\r\n    'Version': '2017-03-12'\r\n}\r\n\r\n# 接口参数，根据实际情况填写，支持json\r\n# 例如数组可以 \"ArrayExample\": [\"1\",\"2\",\"3\"]\r\n# 例如字典可以 \"DictExample\": {\"key1\": \"value1\", \"key2\": \"values2\"}\r\naction_params = {\r\n    'Limit':1,\r\n}\r\n\r\ntry:\r\n    service = QcloudApi(module, config)\r\n\r\n    # 请求前可以通过下面几个方法重新设置请求的secretId/secretKey/Region/method/SignatureMethod参数\r\n    # 重新设置请求的Region\r\n    #service.setRegion('ap-shanghai')\r\n\r\n    # 打印生成的请求URL，不发起请求\r\n    print(service.generateUrl(action, action_params))\r\n    # 调用接口，发起请求，并打印返回结果\r\n    print(service.call(action, action_params))\r\nexcept Exception as e:\r\n    import traceback\r\n    print('traceback.format_exc():\\n%s' % traceback.format_exc())\r\n```\r\n\r\n## 模块对照表\r\n\r\n每个产品都有自己的独立域名，例如云服务器对应的域名为 cvm.api.qcloud.com ，一般域名的第一段对应产品名的缩写（特殊情况会另行说明），此例中为 cvm 。在 SDK 中，产品名缩写对应为模块名，放置于 QcloudApi/modules 目录下（base.py 例外，它是基类），对于没有在 modules 目录列出的产品，依然可以使用。例如在 tests/integration/ckafka 目录下的测试文件 test\\_list\\_instance.py ，表明了调用未显式注册的产品也可以被正常使用，前提是使用产品名和域名首段一致，如果不一致，则以域名首段为准，在使用cmq的产品时将会发生这种情况。\r\n\r\n以下列出目前已经显式支持或者可以动态支持的产品列表，顺序依照官网 API 文档的权重。有些产品已经支持或者部分支持 API 3.0 ，在表格中有注明，建议用户使用 API 3.0 对应的 [SDK](https://github.com/TencentCloud/tencentcloud-sdk-python)。\r\n\r\n请注意，并非所有腾讯云上的产品都支持腾讯云 API ，有部分产品例如对象存储服务（ COS ）有自己独立的 API 和 SDK ，详情请咨询对应产品的技术支持人员。\r\n\r\n部分产品根据自身业务特点，拆分成多个服务，其调用域名根据功能而不同，此种情况下模块名会有多个，请配合官网文档进行使用，本文档不另作说明了。\r\n\r\n以下信息更新于2018-09-25\r\n\r\n| 产品中文名 | 模块名 | 显式支持 | 支持 API 3.0 | 备注\r\n|-|-|-|-|-|\r\n| 云服务器 | cvm、image、dfw、eip | 是 | 是 | |\r\n| 云硬盘 | cbs、snapshot | 是 | 是 | |\r\n| 黑石物理服务器 | bm、bmlb、bmeip、bmvpc | 是 | 部分 | |\r\n| 容器服务 | ccs、ccr | 是 | 否 | |\r\n| 弹性伸缩 | scaling | 是 | 是 | |\r\n| 负载均衡 | lb | 是 | 否 | |\r\n| 无服务器云函数 | scf | 是 | 部分 | |\r\n| 私有网络 | vpc | 是 | 是 | |\r\n| 批量计算 | batch | 是 | 是 | |\r\n| API网关 | apigateway | 是 | 否 | |\r\n| 专线接入 | dc | 是 | 是 | |\r\n| 动态加速网络 | dsa | 否 | 否 | |\r\n| 消息队列 CKafka | ckafka | 否 | 否 | |\r\n| 消息队列 IoT MQ | mqiot | 否 | 否 | |\r\n| 消息队列 CMQ | cmq-queue-{REGION} | 否 | 否 | 产品域名不固定，和区域有关 |\r\n| 数据库 MySQL | cdb | 是 | 是 | |\r\n| 数据库 MariaDB（TDSQL）| tdsql | 是 | 是 | |\r\n| 数据库 SQL Server | sqlserver | 否 | 是 | |\r\n| 内容分发网络 | cdn | 是 | 否 | |\r\n| 弹性缓存 Redis | redis | 是 | 部分 | |\r\n| 弹性缓存 Memcached | cmem | 是 | 否 | |\r\n| 文档数据库 MongoDB | mongodb | 否 | 否 | |\r\n| 云监控 | monitor | 是 | 否 | |\r\n| TBaaS | tbaas | 是 | 是 | |\r\n| 访问管理 | cam、sts | 部分 | 否 | |\r\n| 大禹网络安全 | bgpip、shield | 部分 | 否 | |\r\n| 天御业务安全防护 | sec | 是 | 否 | 产品域名为 csec\r\n| 云审计 | cloudaudit | 是 | 否 | |\r\n| 云解析 | cns | 是 | 否 | |\r\n| SSL 证书 | wss | 否 | 否 | |\r\n| 云搜 | yunsou | 是 | 否 | |\r\n| 文智自然语言处理 | wenzhi | 是 | 否 | |\r\n| 点播 | vod | 是 | 否 | |\r\n| 云市场 | market | 是 | 是 | |\r\n| 直播 | live | 是 | 部分 | |\r\n| 腾讯机器翻译 | tmt | 是 | 是 | |\r\n| 物联网通信 | iotcloud | 否 | 否 | |\r\n| 弹性 Mapreduce | emr | 是 | 否 | |\r\n| 账号相关 | trade、tag、account、feecenter | 部分 | 否 | |\r\n| 渠道合作伙伴 | partners | 是 | 是 | |\r\n| 金融智能客服 | athena | 是 | 否 | |\r\n"
  },
  {
    "path": "README.rst",
    "content": "===============================\nThe Qcloud API SDK for Python\n===============================\n\nQcloud Python SDK is the official software development kit, which allows Python developers to write software that makes use of qcloud services like CVM and CBS.\n\nThe SDK works on Python versions:\n\n   * 2.7 and greater, including 3.x.x\n\nQuick Start\n-----------\nFirst, install the library:\n\n.. code-block:: sh\n\n    $ pip install qcloudapi-sdk-python\n\nor download source code from github and install:\n\n.. code-block:: sh\n\n    $ git clone https://github.com/QcloudApi/qcloudapi-sdk-python.git\n    $ cd qcloudapi-sdk-python\n    $ python setup.py install\n\nThen, from a Python interpreter or script:\n\n.. code-block:: python\n\n    >>> from QcloudApi.qcloudapi import QcloudApi\n    >>> module = 'cvm'\n    >>> action = 'DescribeInstances'\n    >>> config = {'Region':'ap-guangzhou', 'secretId':'xxxx', 'secretKey':'xxxx', 'Version':'2017-03-20'}\n    >>> params = {'Limit':1}\n    >>> service = QcloudApi(module, config)\n    >>> service.call(action, params)\n"
  },
  {
    "path": "setup.cfg",
    "content": "[bdist_wheel]\nuniversal=1\n"
  },
  {
    "path": "setup.py",
    "content": "#!/usr/bin/env python\n\n\"\"\"\ndistutils/setuptools install script.\n\"\"\"\nimport os\nfrom setuptools import setup, find_packages\n\nimport QcloudApi\n\nROOT = os.path.dirname(__file__)\n\nsetup(\n    name='qcloudapi-sdk-python',\n    version=QcloudApi.__version__,\n    description='The Qcloud Api SDK for Python',\n    long_description=open('README.rst').read(),\n    author='Qcloud',\n    url='https://github.com/QcloudApi/qcloudapi-sdk-python.git',\n    maintainer_email=\"QcloudApi@tencent.com\",\n    scripts=[],\n    packages=find_packages(exclude=[\"tests*\"]),\n    license=\"Apache License 2.0\",\n    platforms='any',\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Intended Audience :: Developers',\n        'License :: OSI Approved :: Apache Software License',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2.6',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.1',\n        'Programming Language :: Python :: 3.2',\n        'Programming Language :: Python :: 3.3',\n        'Programming Language :: Python :: 3.4',\n        'Programming Language :: Python :: 3.5',\n        'Programming Language :: Python :: 3.6',\n    ],\n)\n"
  },
  {
    "path": "tests/__init__.py",
    "content": ""
  },
  {
    "path": "tests/demo.py",
    "content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# 引入云API入口模块\nfrom QcloudApi.qcloudapi import QcloudApi\n\n'''\nmodule: 设置需要加载的模块\n已有的模块列表：\ncvm      对应   cvm.api.qcloud.com\ncdb      对应   cdb.api.qcloud.com\nlb       对应   lb.api.qcloud.com\ntrade    对应   trade.api.qcloud.com\nsec      对应   csec.api.qcloud.com\nimage    对应   image.api.qcloud.com\nmonitor  对应   monitor.api.qcloud.com\ncdn      对应   cdn.api.qcloud.com\n'''\nmodule = 'cvm'\n\n'''\naction: 对应接口的接口名，请参考wiki文档上对应接口的接口名\n'''\naction = 'DescribeInstances'\n\n'''\nconfig: 云API的公共参数\n'''\nconfig = {\n    'Region': 'ap-guangzhou',\n    'secretId': '您的secretId',\n    'secretKey': '您的secretKey',\n}\n\n# 接口参数\naction_params = {\n    'Version': '2017-03-12',\n    'Filters': [{\n        'Name': 'zone',\n        'Values': ['ap-guangzhou-1', 'ap-guangzhou-2']\n    }],\n    'limit': 1,\n}\n\ntry:\n    service = QcloudApi(module, config)\n    print(service.generateUrl(action, action_params))\n    print(service.call(action, action_params))\nexcept Exception as e:\n    import traceback\n    print('traceback.format_exc():\\n%s' % traceback.format_exc())\n"
  },
  {
    "path": "tests/functional/__init__.py",
    "content": ""
  },
  {
    "path": "tests/functional/test_cvm.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Test cvm basic functionalities.\"\"\"\n\n\nfrom QcloudApi.common import request\nfrom QcloudApi import qcloudapi\n\n\ndef test_describe_instances(monkeypatch):\n    def mock(*args, **kwargs):\n        return request.ResponseInternal(status=200)\n    monkeypatch.setattr(request.ApiRequest, 'send_request', mock)\n    config = {\n        'Region': 'gz',\n        'secretId': '123',\n        'secretKey': '456',\n    }\n    service = qcloudapi.QcloudApi('cvm', config)\n    service.call('DescribInstances', {})\n"
  },
  {
    "path": "tests/integration/ckafka/test_list_instance.py",
    "content": "# Copyright (c) 1999-2018 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport json\nimport os\n\nfrom QcloudApi import qcloudapi\n\n\ndef test_describe_instances():\n    config = {\n        \"Region\": \"ap-guangzhou\",\n        \"secretId\": os.environ.get(\"TENCENTCLOUD_SECRET_ID\"),\n        \"secretKey\": os.environ.get(\"TENCENTCLOUD_SECRET_KEY\"),\n    }\n    service = qcloudapi.QcloudApi(\"ckafka\", config)\n    result = service.call(\"ListInstance\", {},\n                          req_timeout=10, debug=True).decode(\"utf-8\")\n    assert json.loads(result)[\"code\"] == 0\n"
  },
  {
    "path": "tests/integration/cvm/test_describe_instances.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport json\nimport os\n\nfrom QcloudApi import qcloudapi\n\n\ndef test_describe_instances():\n    config = {\n        \"Region\": \"ap-guangzhou\",\n        \"secretId\": os.environ.get(\"TENCENTCLOUD_SECRET_ID\"),\n        \"secretKey\": os.environ.get(\"TENCENTCLOUD_SECRET_KEY\"),\n    }\n    service = qcloudapi.QcloudApi(\"cvm\", config)\n    params = {\n        \"Version\": \"2017-03-12\",\n        \"Limit\": 1,\n    }\n    result = service.call(\"DescribeInstances\", params,\n                          req_timeout=10, debug=True).decode(\"utf-8\")\n    assert len(json.loads(result)[\"Response\"].get(\"InstanceSet\", [])) == 1\n"
  },
  {
    "path": "tests/unit/__init__.py",
    "content": ""
  },
  {
    "path": "tests/unit/common/test_sign.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom QcloudApi.common import sign\n\n\ndef test_sign():\n    s = sign.Sign('secretIdFoo', 'secretKeyBar')\n    params = {\n        'SecretId': 'secretIdFoo',\n        'Region': 'ap-guangzhou',\n        'SignatureMethod': 'HmacSHA1',\n        'Nonce': '1290303896666895346',\n        'Timestamp': '1512393162',\n        'Action': 'DescribeInstances',\n        'Version': '2017-03-12',\n    }\n    ss = s.make('cvm.api.qcloud.com', '/v2/index.php', params,\n                method='POST')\n    assert ss == 'p3n+pxBqF5JGZtDSxoVn5tGngf0='\n\n\ndef test_sign_post_lowercase():\n    s = sign.Sign('secretIdFoo', 'secretKeyBar')\n    params = {\n        'SecretId': 'secretIdFoo',\n        'Region': 'ap-guangzhou',\n        'SignatureMethod': 'HmacSHA1',\n        'Nonce': '1290303896666895346',\n        'Timestamp': '1512393162',\n        'Action': 'DescribeInstances',\n        'Version': '2017-03-12',\n    }\n    ss = s.make('cvm.api.qcloud.com', '/v2/index.php', params,\n                method='post')\n    assert ss == 'p3n+pxBqF5JGZtDSxoVn5tGngf0='\n\n\ndef test_sign_hmacsha256():\n    s = sign.Sign('secretIdFoo', 'secretKeyBar')\n    params = {\n        'SecretId': 'secretIdFoo',\n        'Region': 'ap-guangzhou',\n        'SignatureMethod': 'HmacSHA256',\n        'Nonce': '1290303896666895346',\n        'Timestamp': '1512393162',\n        'Action': 'DescribeInstances',\n        'Version': '2017-03-12',\n    }\n    ss = s.make('cvm.api.qcloud.com', '/v2/index.php', params,\n                method='POST', sign_method='HmacSHA256')\n    assert ss == 'B2T37FRSP6Fk0/q/cdfrTE0p3zX5ooB/2BPWZUFpsj4='\n\n\ndef test_sign_get():\n    s = sign.Sign('secretIdFoo', 'secretKeyBar')\n    params = {\n        'SecretId': 'secretIdFoo',\n        'Region': 'ap-guangzhou',\n        'SignatureMethod': 'HmacSHA1',\n        'Nonce': '1290303896666895346',\n        'Timestamp': '1512393162',\n        'Action': 'DescribeInstances',\n        'Version': '2017-03-12',\n    }\n    ss = s.make('cvm.api.qcloud.com', '/v2/index.php', params,\n                method='GET')\n    assert ss == '5HAq1BOKNLEE2/uauWnp6Zv9Z3c='\n"
  },
  {
    "path": "tests/unit/modules/__init__.py",
    "content": ""
  },
  {
    "path": "tests/unit/modules/test_basic.py",
    "content": "# Copyright 1999-2017 Tencent Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Basic test for modules, simply check if import succeed.\"\"\"\n\n\nfrom QcloudApi.modules import apigateway\nfrom QcloudApi.modules import account\nfrom QcloudApi.modules import athena\nfrom QcloudApi.modules import batch\nfrom QcloudApi.modules import bgpip\nfrom QcloudApi.modules import bill\nfrom QcloudApi.modules import bm\nfrom QcloudApi.modules import bmeip\nfrom QcloudApi.modules import bmlb\nfrom QcloudApi.modules import bmvpc\nfrom QcloudApi.modules import cbs\nfrom QcloudApi.modules import ccr\nfrom QcloudApi.modules import ccs\nfrom QcloudApi.modules import cdb\nfrom QcloudApi.modules import cdn\nfrom QcloudApi.modules import cloudaudit\nfrom QcloudApi.modules import cmem\nfrom QcloudApi.modules import cns\nfrom QcloudApi.modules import cvm\nfrom QcloudApi.modules import dc\nfrom QcloudApi.modules import dfw\nfrom QcloudApi.modules import eip\nfrom QcloudApi.modules import emr\nfrom QcloudApi.modules import feecenter\nfrom QcloudApi.modules import image\nfrom QcloudApi.modules import lb\nfrom QcloudApi.modules import live\nfrom QcloudApi.modules import market\nfrom QcloudApi.modules import monitor\nfrom QcloudApi.modules import partners\nfrom QcloudApi.modules import redis\nfrom QcloudApi.modules import scaling\nfrom QcloudApi.modules import scf\nfrom QcloudApi.modules import sec\nfrom QcloudApi.modules import snapshot\nfrom QcloudApi.modules import sts\nfrom QcloudApi.modules import tbaas\nfrom QcloudApi.modules import tdsql\nfrom QcloudApi.modules import tmt\nfrom QcloudApi.modules import trade\nfrom QcloudApi.modules import vod\nfrom QcloudApi.modules import vpc\nfrom QcloudApi.modules import wenzhi\nfrom QcloudApi.modules import yunsou\n\n\ndef test_import():\n    \"\"\"test to ensure pr #22 will never happen again.\"\"\"\n    pass\n"
  },
  {
    "path": "tox.ini",
    "content": "[tox]\nminversion = 1.8\nskipsdist = True\nenvlist = py{27,35,36},pep8\n\n[testenv]\ndeps =\n    pytest\n    pytest-cov\nusedevelop = True\ncommands =\n    py.test {toxinidir}/tests\npassenv =\n\tTENCENTCLOUD_SECRET_ID\n\tTENCENTCLOUD_SECRET_KEY\n\tHTTPS_PROXY\n\n[testenv:coveralls]\npassenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH COVERALLS_REPO_TOKEN\ndeps =\n    {[testenv]deps}\n    coveralls\ncommands =\n    py.test --cov {toxinidir}/QcloudApi {toxinidir}/tests\n    coveralls\n\n[testenv:pep8]\ndeps = pycodestyle\ncommands =\n    pycodestyle\n\n[pycodestyle]\nignore =\nexclude=.tox/,doc/\nshow-source = True\n"
  }
]