lczub / TestLink-API-Python-client

A Python client to use the TestLink API
105 stars 63 forks source link

testlink.testlinkerrors.TLConnectionError: problems connecting the TestLink Server #111

Closed Lakshmipathi closed 5 years ago

Lakshmipathi commented 5 years ago

Issue:

Looks like there is some issue running example as mentioned in documentation. I was kind of stuck with below errors for quite some time.

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/testlink/testlinkdecorators.py", line 112, in wrapperAddDevKey return methodAPI(self, *argsPositional, *argsOptional) File "/usr/local/lib/python2.7/dist-packages/testlink/testlinkdecorators.py", line 100, in wrapperWithArgs argsPositional, **argsOptional) File "/usr/local/lib/python2.7/dist-packages/testlink/testlinkapigeneric.py", line 1517, in callServerWithPosArgs response = self._callServer(methodNameAPI, argsOptional) File "/usr/local/lib/python2.7/dist-packages/testlink/testlinkapigeneric.py", line 1996, in _callServer raise testlinkerrors.TLConnectionError(new_msg) testlink.testlinkerrors.TLConnectionError: problems connecting the TestLink Server http://192.168.1.2/testlink/lib/api/xmlrpc/v1/xmlrpc.php <ProtocolError for 192.168.1.2/testlink/lib/api/xmlrpc/v1/xmlrpc.php: 404 Not Found>

After searching a lot came across QA like: https://stackoverflow.com/questions/16467629/testlink-xmlrpc-api-via-python-404-not-found but none of them worked in my case.

Solution:

Finally fixing "TESTLINK_API_PYTHON_SERVER_URL" like below resolved this issue.

export TESTLINK_API_PYTHON_SERVER_URL="http://192.168.1.2/lib/api/xmlrpc/v1/xmlrpc.php" export TESTLINK_API_PYTHON_DEVKEY="abcd1234"

Version 1.9.16.tar.gz

DocumentRoot /var/www/html/testlink-code-1.9.16/

python

import testlink tls = testlink.TestLinkHelper().connect(testlink.TestlinkAPIClient) tls.countProjects()

Hope this helps future users :-)

lczub commented 5 years ago

Hello , thanks for your hints. Could please explain, where your solution differs from How to talk with TestLink ?

One difference might be, that you use export to define your environment, but that is a known difference between windows and linux.

Thanks and Regards Luiko

Lakshmipathi commented 5 years ago

Hi Luiko,

Initially I was using

set TESTLINK_API_PYTHON_SERVER_URL=http://[YOURSERVER]/testlink/lib/api/xmlrpc/v1/xmlrpc.php

After some debugging/searching found out that I need to change above URL to something like:

set TESTLINK_API_PYTHON_SERVER_URL=http://[YOURSERVER]/lib/api/xmlrpc/v1/xmlrpc.php

In apache my Root is definied as DocumentRoot /var/www/html/testlink-code-1.9.16/

May be I configured http server in different manner, but I think it will be helpful to have FAQ section mentioning

If you get error like "/testlink/lib/api/xmlrpc/v1/xmlrpc.php: 404 Not Found" , try changing url to <YOURSERVER>/lib/api/xmlrpc/v1/xmlrpc.php or verify your Testlink apache setup.

thanks!

Lakshmipathi commented 5 years ago

The documentation works if we get Testlink from bitnami. I'll go ahead and mark this closed.

gho21 commented 5 years ago

I just installed the testlink OVA from bitnami on my Vmware ESX server and I had to drop "testlink" from the URL to make API calls work as well. Thanks Lakshmipathi for the great help!