Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
# Connect to Knot server.
ctl = libknot.control.KnotCtl()
ctl.connect(ctl_socket)
ctl.set_timeout(ctl_timeout)
# Get global metrics.
global_stats = dict()
try:
ctl.send_block(cmd="stats", flags=ctl_flags)
global_stats = ctl.receive_stats()
except:
pass
# Get zone metrics.
zone_stats = dict()
try:
ctl.send_block(cmd="zone-stats", flags=ctl_flags)
zone_stats = ctl.receive_stats()
def send():
# Connect to Knot server.
ctl = libknot.control.KnotCtl()
ctl.connect(ctl_socket)
ctl.set_timeout(ctl_timeout)
# Get global metrics.
global_stats = dict()
try:
ctl.send_block(cmd="stats", flags="F")
global_stats = ctl.receive_stats()
except:
pass
# Get zone metrics.
zone_stats = dict()
try:
ctl.send_block(cmd="zone-stats", flags="F")
zone_stats = ctl.receive_stats()