def post(self): data = request.json action = data['action'] if str(action).lower() in ["true", "enable", "on"]: enable_telemetry(ca.config_obj['storage_dir']) else: disable_telemetry(ca.config_obj['storage_dir']) inject_telemetry_to_static(ca.config_obj.paths['static']) return '', 200
def _open_webbrowser(url: str, pid: int, port: int, init_static_thread, static_folder): """Open webbrowser with url when http service is started. If some error then do nothing. """ init_static_thread.join() inject_telemetry_to_static(static_folder) logger = get_log('http') try: is_http_active = wait_func_is_true(func=is_pid_listen_port, timeout=10, pid=pid, port=port) if is_http_active: webbrowser.open(url) except Exception as e: logger.error(f'Failed to open {url} in webbrowser with exception {e}') logger.error(traceback.format_exc()) session.close()