Raises HTTPError if the request got an error.

def raise_for_status(self):
        """Raises HTTPError if the request got an error."""
        if 400 <= self.status_code < 600:
            message = 'Error %s for %s' % (self.status_code, self.url)
            raise HTTPError(message)