def check_response(self, response):
        """
        Raises error if the response isn't successful.
        :param response: requests.Response response to be checked
        """
        if response.status_code == 401:
            raise D4S2Error(UNAUTHORIZED_MESSAGE)
        if not 200 <= response.status_code < 300:
            raise D4S2Error("Request to {} failed with {}:\n{}.".format(response.url, response.status_code,
                                                                        response.text))