lczub / TestLink-API-Python-client

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

Testlink access does not work if webserver uses basic auth #99

Closed sam1919 closed 6 years ago

sam1919 commented 6 years ago

I get errors when using basic authentication ( https://httpd.apache.org/docs/2.4/mod/mod_auth_basic.html ) on my testlink webserver:

user@pc ~/testlink $ python test1.py Traceback (most recent call last): File "test1.py", line 6, in tls.countProjects() File "/home/user/.local/lib64/python2.7/site-packages/testlink/testlinkapi.py", line 376, in countProjects projects=self.getProjects() File "/home/user/.local/lib64/python2.7/site-packages/testlink/testlinkdecorators.py", line 140, in wrapperReplaceTLResponseError response = methodAPI(self, *argsPositional, argsOptional) File "/home/user/.local/lib64/python2.7/site-packages/testlink/testlinkdecorators.py", line 112, in wrapperAddDevKey return methodAPI(self, *argsPositional, *argsOptional) File "/home/user/.local/lib64/python2.7/site-packages/testlink/testlinkdecorators.py", line 100, in wrapperWithArgs argsPositional, argsOptional) File "/home/user/.local/lib64/python2.7/site-packages/testlink/testlinkapigeneric.py", line 1513, in callServerWithPosArgs response = self._callServer(methodNameAPI, argsOptional) File "/home/user/.local/lib64/python2.7/site-packages/testlink/testlinkapigeneric.py", line 1773, in _callServer raise testlinkerrors.TLConnectionError(new_msg) testlink.testlinkerrors.TLConnectionError: problems connecting the TestLink Server https://mymachine/testlink/lib/api/xmlrpc/v1/xmlrpc.php <ProtocolError for mymachine/testlink/lib/api/xmlrpc/v1/xmlrpc.php: 401 Unauthorized>

How do I add login/password to TestLink-API-Python-client?

lczub commented 6 years ago

Hello sam1919,

sorry for the late response and sorry again, that this answer may not help .

I'm not familiar with authentication stuff. When I understand Authentication and Authorization right, each http request will be checked , if a user has the right to access this url, before the TestLink authetification can start. And your problem is, that it is not known, how to transport the additional required credentials.

Have you try what happens, when you declare TESTLINK_API_PYTHON_SERVER_URL with the notation http://authUSER:authPASSWORD@YOURSERVER/testlink/lib/api/xmlrpc/v1/xmlrpc.php ?

Regards Luiko

sam1919 commented 6 years ago

Hello Luiko,

thanks. That works.