def _request(self, method, body=None, raise_exc=True, headers=None):
        '''Fetches HTTP response using the passed http method. Raises
        HALNavigatorError if response is in the 400-500 range.'''
        headers = headers or {}
        if body and 'Content-Type' not in headers:
            headers.update({'Content-Type': 'application/json'})
        response = self._core.session.request(
            method,
            self.uri,
            data=body if not isinstance(body, dict) else None,
            json=body if isinstance(body, dict) else None,
            headers=headers,
            allow_redirects=False,
        )
        nav = self._create_navigator(response, raise_exc=raise_exc)
        if raise_exc and not response:
            raise exc.HALNavigatorError(
                message=response.text,
                status=response.status_code,
                nav=nav,  # may be self
                response=response,
            )
        else:
            return nav
dataset/ETHPy150Open deontologician/restnavigator/restnavigator/halnav.py/HALNavigator._request/original