def _make_request(self, service, method, params=None, body="<STR_LIT>",<EOL>need_auth=True):
<EOL>if need_auth and not self.cookie:<EOL><INDENT>if not self.login():<EOL><INDENT>return False, None<EOL><DEDENT><DEDENT>headers = self._get_headers(service, method, need_auth)<EOL>if not body:<EOL><INDENT>if not params:<EOL><INDENT>params = "<STR_LIT>"<EOL><DEDENT>if isinstance(params, dict):<EOL><INDENT>_map = params<EOL>params = "<STR_LIT>"<EOL>for k in _map:<EOL><INDENT>params += "<STR_LIT:<>" + k + "<STR_LIT:>>" + _map[k] + "<STR_LIT>" + k + "<STR_LIT>"<EOL><DEDENT><DEDENT>body = CALL_BODY.format(service=SERVICE_PREFIX + service,<EOL>method=method, params=params)<EOL><DEDENT>message = SOAP_REQUEST.format(session_id=SESSION_ID, body=body)<EOL>try:<EOL><INDENT>response = requests.post(self.soap_url, headers=headers,<EOL>data=message, timeout=<NUM_LIT:30>, verify=False)<EOL>if need_auth and _is_unauthorized_response(response):<EOL><INDENT>self.cookie = None<EOL>_LOGGER.warning("<STR_LIT>")<EOL>if self.login():<EOL><INDENT>headers = self._get_headers(service, method, need_auth)<EOL>response = requests.post(self.soap_url, headers=headers,<EOL>data=message, timeout=<NUM_LIT:30>, verify=False)<EOL><DEDENT><DEDENT>success = _is_valid_response(response)<EOL>if not success:<EOL><INDENT>_LOGGER.error("<STR_LIT>")<EOL>_LOGGER.debug("<STR_LIT>", response.status_code, str(response.headers), response.text)<EOL><DEDENT>return success, response<EOL><DEDENT>except requests.exceptions.RequestException:<EOL><INDENT>_LOGGER.exception("<STR_LIT>")<EOL>return False, None<EOL><DEDENT>
Make an API request to the router.