'Raises stored :class:`HTTPError` or :class:`URLError`, if one occurred.'

def raise_for_status(self, allow_redirects=True):

    if self.error:
        raise self.error
    http_error_msg = ''
    if ((300 <= self.status_code < 400) and (not allow_redirects)):
        http_error_msg = ('%s    Redirection:    %s' % (self.status_code, self.reason))
    elif (400 <= self.status_code < 500):
        http_error_msg = ('%s    Client    Error:    %s' % (self.status_code, self.reason))
    elif (500 <= self.status_code < 600):
        http_error_msg = ('%s    Server    Error:    %s' % (self.status_code, self.reason))
    if http_error_msg:
        http_error = HTTPError(http_error_msg)
        http_error.response = self
        raise http_error
