6 This example performs the name lookup in the background.
7 The main program keeps running while the name is resolved.
18 ctx = unbound.ub_ctx()
19 ctx.resolvconf("/etc/resolv.conf")
21 def call_back(my_data,status,result):
22 print "Call_back:", my_data
23 if status == 0 and result.havedata:
24 print "Result:", result.data.address_list
25 my_data['done_flag'] = True
28 my_data = {'done_flag':False,'arbitrary':"object"}
29 status, async_id = ctx.resolve_async("www.seznam.cz", my_data, call_back, unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
31 while (status == 0) and (not my_data['done_flag']):
32 status = ctx.process()
36 print "Resolve error:", unbound.ub_strerror(status)
38 The :meth:`unbound.ub_ctx.resolve_async` method is able to pass on any Python
39 object. In this example, we used a dictionary object ``my_data``.