Skip to content
Snippets Groups Projects
Commit 15cd3fb0 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

python: tiny control example extension

parent 0d949134
No related branches found
No related tags found
No related merge requests found
Pipeline #98843 passed
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment