def get()

in decisionai_plugin/common/tsanaclient.py [0:0]


    def get(self, api_endpoint, instance_id, api_key, user, path):
        if not api_endpoint.startswith('http'):
            api_endpoint = "https://" + api_endpoint

        url = api_endpoint.rstrip('/') + path

        headers = {
            "x-api-key": api_key,
            "x-user": user,
            "X-Base-Address": api_endpoint,
            "Instance-Id": instance_id,
            "X-Action-Source": "Plugin",
            "Content-Type": "application/json"
        }

        if self.username and self.password:
            auth = (self.username, self.password)
        else:
            auth = None

        if self.crt and self.key:
            cert = (self.crt, self.key)
        else:
            cert = None

        try:
            r = self.retryrequests.get(url=url, headers=headers, auth=auth, timeout=REQUEST_TIMEOUT_SECONDS,
                                       cert=cert, verify=False)
            try:
                return r.json()
            except ValueError:
                return r.content
        except Exception as e:
            raise Exception('TSANA service api "{}" failed, {}'.format(url, str(e)))