def _request(self, http_method, stem, data={}, params={}):
        url = '%s/%s' % (self.url, stem)
        data = json.dumps(data)
        # getting rid of control characters
        # that JSON will error out on
        data = data.replace('\\r', ' ')
        data = data.replace('\\t', ' ')
        data = data.replace('\\n', ' ')
        kwargs = {
            'params': params,
            'data': data,
            'headers': self.headers,
            'auth': (self.username, self.password),
            'proxies': self.proxies,
            'timeout': self.timeout
        }
        resp = None
        try:
            if http_method == 'GET':
                resp = requests.get(url, **kwargs)
            elif http_method == 'POST':
                resp = requests.post(url, **kwargs)
        except (requests.exceptions.ConnectionError, requests.exceptions.SSLError, requests.exceptions.HTTPError, requests.exceptions.Timeout) as e:
            self.logger.warning(e)
            raise AvalaraServerNotReachableException(e)
        if resp.status_code == requests.codes.ok:
            if resp.json is None:
                raise AvalaraServerDetailException(resp)
            return resp
        else:
            raise AvalaraServerDetailException(resp)
dataset/ETHPy150Open activefrequency/pyavatax/pyavatax/base.py/BaseAPI._request/original