Maintained by: NLnet Labs

[Unbound-users] Can python module handle an answer of DNS query?

Christopher Olah
Tue Sep 6 02:15:03 CEST 2011

You can do this in ldns, but may find it easier to do in ldnsx ( Using the convenience function
get_rrs() we can do:

import ldnsx
ip_addr = ldnsx.get_rrs("","A")[0].ip()

Though you'll get an exception if there aren't any A records.

Alternatively, you could not use convenience functions and do:

import ldnsx
res = ldnsx.resolver()
pkt = res.query("","A")
ans = pkt.answer()
ip_addr = ans[0].ip()


On Mon, Sep 5, 2011 at 3:07 PM, Rishat <rishat at> wrote:

> **
> Hello
> Having python module i want to record queries and answers to MySQL
> database. From example1,2 i know how to get queries like "" but
> don't yet know which python variable can get me answer of IP address list
> from respond. Is it possible with python module to do this?
> Sorry for my English and thanks in advance.
> BR Rishat
> _______________________________________________
> Unbound-users mailing list
> Unbound-users at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>