通过python连接到Testlink时出现“unbound method connect()”错误

时间:2017-06-07 10:06:43

标签: python testlink

from XMLRPC.TestLinkAPI.src import testlink
class ConnectToTestLink:

    TESTLINK_API_PYTHON_SERVER_URL = "abc.com";
    TESTLINK_API_PYTHON_DEVKEY = "e9e245fdhsgfdsghfd18e9"
    tls = testlink.TestLinkHelper.connect(testlink.TestlinkAPIClient)
    #tls.countProjects();

我收到以下错误:

unbound method connect() must be called with TestLinkHelper instance as first argument (got type instance instead)

(作为参考,我关注此网址: https://pypi.python.org/pypi/TestLink-API-Python-client

2 个答案:

答案 0 :(得分:0)

 tls = testlink.TestLinkHelper(ConnectToTestLink.TESTLINK_API_PYTHON_SERVER_URL,
                                  ConnectToTestLink.TESTLINK_API_PYTHON_DEVKEY).connect(testlink.TestlinkAPIClient)

答案 1 :(得分:0)

您可以添加

from testlink import TestlinkAPIGeneric, TestLinkHelper

然后

TESTLINK_API_PYTHON_SERVER_URL = "abc.com";
TESTLINK_API_PYTHON_DEVKEY = "e9e245fdhsgfdsghfd18e9"

my_test_link = TestLinkHelper(TESTLINK_API_PYTHON_SERVER_URL, TESTLINK_API_PYTHON_DEVKEY).connect(TestlinkAPIGeneric)