def change_state(api_url, post_data):
 for _ in range(LOGIN_RETRIES):
  req = requests.post(urljoin(ZM['url'], api_url), data=post_data, cookies=ZM['cookies'], timeout=DEFAULT_TIMEOUT)
  if (req.status_code != requests.codes.ok):
   login()
  else:
   break
 else:
  _LOGGER.exception('Unable to get API response from ZoneMinder')
 return json.loads(req.text)

def change_state ( api_url , post_data ) : for _ in range ( LOGIN_RETRIES ) : req = requests . post ( urljoin ( ZM [ 'url' ] , api_url ) , data = post_data , cookies = ZM [ 'cookies' ] , timeout = DEFAULT_TIMEOUT ) if ( req . status_code != requests . codes . ok ) : login ( ) else : break else : _LOGGER . exception ( 'Unable to get API response from ZoneMinder' ) return json . loads ( req . text )
update a state using the zoneminder api .