简体   繁体   中英

Using testlink API Invalid DevKey Error message

I am currently using Testlink 1.9.11 and I have difficulties to use the API for testlink. I searched on the web for similar issues but nothing helped.

Here are the scenario that I follow in order to try to use the API:

  1. Log in as my user with admin rights)

  2. Go to 'My settings' and under API interface, I click on 'Generate a new key' button (-> meaning that $tlCfg->api->enabled = TRUE)

  3. I have tried this Python code

    TESTLINK_API_PYTHON_SERVER_URL="http://xxxxxxxx/testlink/lib/api/xmlrpc/v1/xmlrpc.php" TESTLINK_API_PYTHON_DEVKEY=["xxxxxxxx"] import testlink tls =testlink.TestlinkAPIClient(TESTLINK_API_PYTHON_SERVER_URL,TESTLINK_API_PYTHON_DEVKEY) print (tls.countProjects())

when I try to run python file it show me ==>

raise testlinkerrors.TLResponseError( testlink.testlinkerrors.TLResponseError: 2000: Can not authenticate client: invalid developer key

I find the solution

Import testlink
from testlink import  TestLinkHelper

TestLinkHelper.DEFAULT_DEVKEY="http://xxxxxxxx/testlink/lib/api/xmlrpc/v1/xmlrpc.php"
TestLinkHelper.DEFAULT_SERVER_URL=xxxxx"

tlsh = testlink.TestLinkHelper().connect(testlink.TestlinkAPIClient)

print (tlsh.countProjects() )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM