1238106Sdes.. _example_resolver_only: 2238106Sdes 3238106Sdes============================== 4238106SdesResolver only 5238106Sdes============================== 6238106Sdes 7238106SdesThis example program shows how to perform DNS resolution only. 8238106SdesUnbound contains two basic modules: resolver and validator. 9238106SdesIn case, the validator is not necessary, the validator module can be turned off using "module-config" option. 10238106SdesThis option contains a list of module names separated by the space char. This list determined which modules should be employed and in what order. 11238106Sdes 12238106Sdes:: 13238106Sdes 14238106Sdes #!/usr/bin/python 15238106Sdes import os 16238106Sdes from unbound import ub_ctx,RR_TYPE_A,RR_CLASS_IN 17238106Sdes 18238106Sdes ctx = ub_ctx() 19238106Sdes ctx.set_option("module-config:","iterator") 20238106Sdes ctx.resolvconf("/etc/resolv.conf") 21238106Sdes 22238106Sdes status, result = ctx.resolve("www.google.com", RR_TYPE_A, RR_CLASS_IN) 23238106Sdes if status == 0 and result.havedata: 24238106Sdes 25238106Sdes print "Result:", result.data.address_list 26238106Sdes 27238106Sdes.. note:: 28238106Sdes The :meth:`unbound.ub_ctx.set_option` method must be used before the first resolution (i.e. before :meth:`unbound.ub_ctx.resolve` or :meth:`unbound.ub_ctx.resolve_async` call). 29238106Sdes 30