summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorDaniel Salzman <daniel.salzman@nic.cz>2022-05-12 12:47:20 +0200
committerDaniel Salzman <daniel.salzman@nic.cz>2022-05-12 12:47:20 +0200
commit15cd3fb0443b77ff49707b77ecc7df75ad52bb3b (patch)
tree011c1599d1b3e60e05f1fe73b1f8b3d7faeac4da /python
parentMerge branch 'tests-refactor' into 'master' (diff)
downloadknot-15cd3fb0443b77ff49707b77ecc7df75ad52bb3b.tar.xz
knot-15cd3fb0443b77ff49707b77ecc7df75ad52bb3b.zip
python: tiny control example extension
Diffstat (limited to 'python')
-rw-r--r--python/README.md4
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)