def postResponse(self, cmd, data):
        req = Request('%s%s' % (self.URL, cmd), json.dumps(data))
        req.headers = {'content-type': 'application/json'}
        if self.user is not None and self.password is not None:
            req.headers['Authorization'] = 'Basic ' + base64.b64encode(
                '%s:%s' % (self.user, self.password))

        try:
            resp = urlopen(req)
            studies = json.loads(resp.read())
            resp.close()
            return studies
        except HTTPError as e:
            self.logger.error(
                'POST error! ' + e.read()
            )  # Do not include a traceback, that's not interesting here (it's not a bug, but Orthanc complaining...)
            raise
    def getResponse(self, cmd):
        req = Request('%s%s' % (self.URL, cmd))
        req.headers = {}
        if self.user is not None and self.password is not None:
            req.headers['Authorization'] = 'Basic ' + base64.b64encode(
                six.b('%s:%s' % (self.user, self.password))).decode("utf-8")

        try:
            resp = urlopen(req)
            studies = json.loads(resp.read().decode("utf-8"))
            resp.close()
            return studies
        except HTTPError as e:
            self.logger.error(
                'GET error! ' + e.read()
            )  # Do not include a traceback, that's not interesting here (it's not a bug, but Orthanc complaining...)
            raise