Since the DNR calls all execute asynchronously you do not get the results back immediately. Instead, you get a dnr result object. You can check this object to see whether the query is complete, and access its attributes to obtain the information when it is.
Alternatively, you can also reference the result attributes directly, this will result in an implicit wait for the query to complete.
The rtnCode and cname attributes are always available, the others depend on the type of query (address, hinfo or mx).
1
if the query is complete.
The simplest way to use the module to convert names to dotted-decimal strings, without worrying about idle time, etc:
>>> def gethostname(name): ... import macdnr ... dnrr = macdnr.StrToAddr(name) ... return macdnr.AddrToStr(dnrr.ip0)