2 from unbound import ub_ctx,ub_strerror,RR_TYPE_A,RR_CLASS_IN
5 ctx.resolvconf("/etc/resolv.conf")
7 status, result = ctx.resolve("test.record.xxx", RR_TYPE_A, RR_CLASS_IN)
8 if status == 0 and result.havedata:
9 print "Result:", result.data.address_list
11 print "No record found"
13 #define new local zone
14 status = ctx.zone_add("xxx.","static")
15 if (status != 0): print "Error zone_add:",status, ub_strerror(status)
18 status = ctx.data_add("test.record.xxx. IN A 1.2.3.4")
19 if (status != 0): print "Error data_add:",status, ub_strerror(status)
21 #lookup for an A record
22 status, result = ctx.resolve("test.record.xxx", RR_TYPE_A, RR_CLASS_IN)
23 if status == 0 and result.havedata:
24 print "Result:", result.data.as_address_list()
26 print "No record found"