def request(self, method, url, query_params=None, headers=None,<EOL>body=None, post_params=None):
method = method.upper()<EOL>assert method in ['<STR_LIT:GET>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:POST>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>if post_params and body:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>post_params = post_params or {}<EOL>headers = headers or {}<EOL>if '<STR_LIT:Content-Type>' not in headers:<EOL><INDENT>headers['<STR_LIT:Content-Type>'] = '<STR_LIT:application/json>'<EOL><DEDENT>try:<EOL><INDENT>if method in ['<STR_LIT:POST>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>if query_params:<EOL><INDENT>url += '<STR_LIT:?>' + urlencode(query_params)<EOL><DEDENT>if headers['<STR_LIT:Content-Type>'] == '<STR_LIT:application/json>':<EOL><INDENT>request_body = None<EOL>if body is not None:<EOL><INDENT>request_body = json.dumps(body)<EOL><DEDENT>r = self.pool_manager.request(method, url,<EOL>body=request_body,<EOL>headers=headers)<EOL><DEDENT>if headers['<STR_LIT:Content-Type>'] == '<STR_LIT>':<EOL><INDENT>r = self.pool_manager.request(method, url,<EOL>fields=post_params,<EOL>encode_multipart=False,<EOL>headers=headers)<EOL><DEDENT>if headers['<STR_LIT:Content-Type>'] == '<STR_LIT>':<EOL><INDENT>del headers['<STR_LIT:Content-Type>']<EOL>r = self.pool_manager.request(method, url,<EOL>fields=post_params,<EOL>encode_multipart=True,<EOL>headers=headers)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>r = self.pool_manager.request(method, url,<EOL>fields=query_params,<EOL>headers=headers,<EOL>preload_content=False)<EOL><DEDENT><DEDENT>except urllib3.exceptions.SSLError as e:<EOL><INDENT>msg = "<STR_LIT>".format(type(e).__name__, str(e))<EOL>raise ApiException(status=<NUM_LIT:0>, reason=msg)<EOL><DEDENT>r = RESTResponse(r, method)<EOL>logger.debug("<STR_LIT>" % r.data)<EOL>if r.status not in range(<NUM_LIT:200>, <NUM_LIT>):<EOL><INDENT>raise ApiException(http_resp=r)<EOL><DEDENT>return r<EOL>
:param method: http request method
:param url: http request url
:param query_params: query parameters in the url
:param headers: http request headers
:param body: request json body, for `application/json`
:param post_params: request post parameters,
                    `application/x-www-form-urlencode`
                    and `multipart/form-data`