diff options
author | Daniel Salzman <daniel.salzman@nic.cz> | 2022-05-12 12:47:20 +0200 |
---|---|---|
committer | Daniel Salzman <daniel.salzman@nic.cz> | 2022-05-12 12:47:20 +0200 |
commit | 15cd3fb0443b77ff49707b77ecc7df75ad52bb3b (patch) | |
tree | 011c1599d1b3e60e05f1fe73b1f8b3d7faeac4da /python | |
parent | Merge branch 'tests-refactor' into 'master' (diff) | |
download | knot-15cd3fb0443b77ff49707b77ecc7df75ad52bb3b.tar.xz knot-15cd3fb0443b77ff49707b77ecc7df75ad52bb3b.zip |
python: tiny control example extension
Diffstat (limited to 'python')
-rw-r--r-- | python/README.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/python/README.md b/python/README.md index 8a58aaae3..548d9c0f9 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) |