Resolver onlyΒΆ

This example program shows how to perform DNS resolution only. Unbound contains two basic modules: resolver and validator. In case, the validator is not necessary, the validator module can be turned off using “module-config” option. This option contains a list of module names separated by the space char. This list determined which modules should be employed and in what order.

import os
from unbound import ub_ctx,RR_TYPE_A,RR_CLASS_IN

ctx = ub_ctx()

status, result = ctx.resolve("", RR_TYPE_A, RR_CLASS_IN)
if status == 0 and result.havedata:

    print "Result:",


The unbound.ub_ctx.set_option() method must be used before the first resolution (i.e. before unbound.ub_ctx.resolve() or unbound.ub_ctx.resolve_async() call).

Previous topic

DNSSEC Validate

Next topic

Local zone manipulation

Quick search