unbound/testdata/pylib.tdir/pylib.lookup.py
wouter 8ba25b126a tests in tdir format.
git-svn-id: https://unbound.nlnetlabs.nl/svn/trunk@4264 be551aaa-1e26-0410-a405-d3ace91eadb9
2017-07-06 13:27:30 +00:00

25 lines
469 B
Python
Executable File

#!/usr/bin/env python
'''
Test for unbound lookup.
BSD licensed.
'''
import unbound
ctx = unbound.ub_ctx()
status = ctx.config("ub.conf")
if status != 0:
print "read config failed ", status
exit(1)
print "config created"
status, result = ctx.resolve("www.example.com", unbound.RR_TYPE_A, unbound.RR_CLASS_IN);
if status == 0 and result.havedata:
print "Result: ", result.data.address_list
else:
print "Failed ", status, " and data ", result
ctx = None
exit(0)