Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Fail to send get request using API Key

Hi,

I have a question about how to API key to get a test case information.

  1. Created and saved an API key from TestRail website.
  2. Downloaded testrail.py and put it under the project root folder
  3. Got an error when I tried to run my script to send a request.
    Screenshot of the script
    2019-08-16_1502
    Error message
    Traceback (most recent call last):
    File “script.py”, line 7, in
    case = client.send_get(‘get_case/1’)
    File “D:\python_test\testrail.py”, line 42, in send_get
    return self.__send_request(‘GET’, uri, filepath)
    File “D:\python_test\testrail.py”, line 65, in __send_request
    auth = base64.b64encode(’%s:%s’ % (self.user, self.password))
    File “C:\Users\eric.yun\AppData\Local\Programs\Python\Python37-32\lib\base64.py”, line 58, in b64encode
    encoded = binascii.b2a_base64(s, newline=False)
    TypeError: a bytes-like object is required, not ‘str’