def _create_navigator(self, response, raise_exc=True):
        '''Create the appropriate navigator from an api response'''
        method = response.request.method
        # TODO: refactor once hooks in place
        if method in (POST, PUT, PATCH, DELETE) \
           and response.status_code in (
                http_client.CREATED,
                http_client.FOUND,
                http_client.SEE_OTHER,
                http_client.NO_CONTENT) \
           and 'Location' in response.headers:
            nav = HALNavigator(
                link=Link(uri=response.headers['Location']),
                core=self._core
            )
            # We don't ingest the response because we haven't fetched
            # the newly created resource yet
        elif method in (POST, PUT, PATCH, DELETE):
            nav = OrphanHALNavigator(
                link=None,
                core=self._core,
                response=response,
                parent=self,
            )
            nav._ingest_response(response)
        elif method == GET:
            nav = self
            nav._ingest_response(response)
        else: # pragma: nocover
            assert False, "This shouldn't happen"

        return nav
dataset/ETHPy150Open deontologician/restnavigator/restnavigator/halnav.py/HALNavigator._create_navigator/original