Refactor the code of osccore-qa-testing-tools  to comply with PEP8.

Related-prod: PRODX-42195
Change-Id: Id05e7584e0d024127ce1bd5042cfe681a1b52e2d
diff --git a/testrail_upload_suites/testrail.py b/testrail_upload_suites/testrail.py
index a2c6523..e56c633 100644
--- a/testrail_upload_suites/testrail.py
+++ b/testrail_upload_suites/testrail.py
@@ -11,18 +11,19 @@
 # Copyright Gurock Software GmbH. See license.md for details.
 #
 
-import requests
-import json
 import base64
+import json
+
+import requests
 
 
 class APIClient:
     def __init__(self, base_url):
-        self.user = ''
-        self.password = ''
-        if not base_url.endswith('/'):
-            base_url += '/'
-        self.__url = base_url + 'index.php?/api/v2/'
+        self.user = ""
+        self.password = ""
+        if not base_url.endswith("/"):
+            base_url += "/"
+        self.__url = base_url + "index.php?/api/v2/"
 
     #
     # Send Get
@@ -39,7 +40,7 @@
     #                     Used only for 'get_attachment/:attachment_id'
     #
     def send_get(self, uri, filepath=None):
-        return self.__send_request('GET', uri, filepath)
+        return self.__send_request("GET", uri, filepath)
 
     #
     # Send POST
@@ -57,48 +58,51 @@
     #                     to the file
     #
     def send_post(self, uri, data):
-        return self.__send_request('POST', uri, data)
+        return self.__send_request("POST", uri, data)
 
     def __send_request(self, method, uri, data):
         url = self.__url + uri
 
         auth = str(
             base64.b64encode(
-                bytes('%s:%s' % (self.user, self.password), 'utf-8')
+                bytes("%s:%s" % (self.user, self.password), "utf-8")
             ),
-            'ascii'
+            "ascii",
         ).strip()
-        headers = {'Authorization': 'Basic ' + auth}
+        headers = {"Authorization": "Basic " + auth}
 
-        if method == 'POST':
-            if uri[:14] == 'add_attachment':    # add_attachment API method
-                files = {'attachment': (open(data, 'rb'))}
+        if method == "POST":
+            if uri[:14] == "add_attachment":  # add_attachment API method
+                files = {"attachment": (open(data, "rb"))}
                 response = requests.post(url, headers=headers, files=files)
-                files['attachment'].close()
+                files["attachment"].close()
             else:
-                headers['Content-Type'] = 'application/json'
-                payload = bytes(json.dumps(data), 'utf-8')
+                headers["Content-Type"] = "application/json"
+                payload = bytes(json.dumps(data), "utf-8")
                 response = requests.post(url, headers=headers, data=payload)
         else:
-            headers['Content-Type'] = 'application/json'
+            headers["Content-Type"] = "application/json"
             response = requests.get(url, headers=headers)
 
         if response.status_code > 201:
             try:
                 error = response.json()
-            except:     # response.content not formatted as JSON
+            except Exception:  # response.content not formatted as JSON
                 error = str(response.content)
-            raise APIError('TestRail API returned HTTP %s (%s)' % (response.status_code, error))
+            raise APIError(
+                "TestRail API returned HTTP %s (%s)"
+                % (response.status_code, error)
+            )
         else:
-            if uri[:15] == 'get_attachment/':   # Expecting file, not JSON
+            if uri[:15] == "get_attachment/":  # Expecting file, not JSON
                 try:
-                    open(data, 'wb').write(response.content)
-                    return (data)
-                except:
-                    return ("Error saving attachment.")
+                    open(data, "wb").write(response.content)
+                    return data
+                except Exception:
+                    return "Error saving attachment."
             else:
                 return response.json()
 
 
 class APIError(Exception):
-    pass
\ No newline at end of file
+    pass