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


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 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
    Error message
    Traceback (most recent call last):
    File “”, line 7, in
    case = client.send_get(‘get_case/1’)
    File “D:\python_test\”, line 42, in send_get
    return self.__send_request(‘GET’, uri, filepath)
    File “D:\python_test\”, line 65, in __send_request
    auth = base64.b64encode(’%s:%s’ % (self.user, self.password))
    File “C:\Users\\AppData\Local\Programs\Python\Python37-32\lib\”, line 58, in b64encode
    encoded = binascii.b2a_base64(s, newline=False)
    TypeError: a bytes-like object is required, not ‘str’