From: Daniel Salzman Date: Thu, 12 May 2022 10:47:20 +0000 (+0200) Subject: python: tiny control example extension X-Git-Tag: v3.3.dev~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15cd3fb0443b77ff49707b77ecc7df75ad52bb3b;p=thirdparty%2Fknot-dns.git python: tiny control example extension --- diff --git a/python/README.md b/python/README.md index 8a58aaae34..548d9c0f99 100644 --- a/python/README.md +++ b/python/README.md @@ -50,6 +50,7 @@ import libknot.control # Initialization ctl = libknot.control.KnotCtl() ctl.connect("/var/run/knot/knot.sock") +ctl.set_timeout(60) try: # Operation without parameters @@ -67,6 +68,9 @@ try: ctl.send_block(cmd="conf-read", section="zone", item="domain") resp = ctl.receive_block() print(json.dumps(resp, indent=4)) +except libknot.control.KnotCtlError as exc: + # Print libknot error + print(exc) finally: # Deinitialization ctl.send(libknot.control.KnotCtlType.END)