I’m having some difficulty setting up the basic API test with Python. I may be missing something obvious, but I’d thought I’d post on here in case the result helps somebody else…
I’m running with Python 3.4, located “C:\Python34”.
I’ve downloaded the Python TestRail API bindings (http://docs.gurock.com/testrail-api2/bindings-python#setup_installation) and have extracted “testrail-api-master\python\3.x\testrail.py” to “C:\Python34”.
I’ve taken the following example from (http://docs.gurock.com/testrail-api2/bindings-python#setup_installation) and saved it as “TEST.py” in “C:\Python\Tests”
[code]from testrail import *
client = APIClient(‘http:///testrail/’)
client.user = ''
client.password = ''
case = client.send_get(‘get_case/1’)
… With the URL, Password and Username replaced and relevant to my installation, when I attempt to execute “TEST.py” in cmd the following error is returned. Any ideas why?
Traceback (most recent call last):
File "C:\Python34\Tests\TEST.py", line 6, in <module>
case = client.send_get('get_case/1')
File "C:\Python34\testrail.py", line 36, in send_get
return self.__send_request('GET', uri, None)
File "C:\Python34\testrail.py", line 76, in __send_request
result = json.loads(response.decode())
File "C:\Python34\lib\json\__init__.py", line 318, in loads
File "C:\Python34\lib\json\decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python34\lib\json\decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)
(I have existing test cases which should be returned)
(The user is active)
(API is enabled)