'Invoke an API method.
Look for sqoop-error-code and sqoop-error-message.
@return: Raw body or JSON dictionary (if response content type is JSON).'

def invoke(self, method, relpath=None, params=None, data=None, headers=None, allow_redirects=False, clear_cookies=False):

    path = self._join_uri(relpath)
    resp = self._client.execute(method, path, params=params, data=data, headers=headers, allow_redirects=allow_redirects)
    if (resp.status_code == 200):
        self._client.logger.debug(('%(method)s    Got    response:\n%(headers)s\n%(body)s' % {'method': method, 'headers': resp.headers, 'body': resp.content}))
        return self._format_response(resp)
    else:
        body = self._format_response(resp)
        msg_format = '%(method)s    Sqoop    Error    (%s):    %s\n DCTB %s'
        args = (resp.headers['sqoop-error-code'], resp.headers['sqoop-error-message'], body)
        self._client.logger.error((msg_format % args))
        raise IOError((_(msg_format) % args))
