def _zm_request(self, method, api_url, data=None,<EOL>timeout=DEFAULT_TIMEOUT) -> dict:
try:<EOL><INDENT>for _ in range(ZoneMinder.LOGIN_RETRIES):<EOL><INDENT>req = requests.request(<EOL>method, urljoin(self._server_url, api_url), data=data,<EOL>cookies=self._cookies, timeout=timeout,<EOL>verify=self._verify_ssl)<EOL>if not req.ok:<EOL><INDENT>self.login()<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>_LOGGER.error('<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>return req.json()<EOL><DEDENT>except ValueError:<EOL><INDENT>_LOGGER.exception('<STR_LIT>'<EOL>'<STR_LIT>', req.text)<EOL>return {}<EOL><DEDENT><DEDENT>except requests.exceptions.ConnectionError:<EOL><INDENT>_LOGGER.exception('<STR_LIT>')<EOL>return {}<EOL><DEDENT>
Perform a request to the ZoneMinder API.