dnr result object -- Python library reference
Prev: macdnr
Up: macdnr
Top: Top
14.5.1. dnr result object
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).
- wait () -- Method on dnr result object
-
Wait for the query to complete.
- isdone () -- Method on dnr result object
-
Return 1 if the query is complete.
- rtnCode -- attribute of dnr result object
-
The error code returned by the query.
- cname -- attribute of dnr result object
-
The canonical name of the host that was queried.
- ip0 -- attribute of dnr result object
-
- ip1 -- attribute of dnr result object
-
- ip2 -- attribute of dnr result object
-
- ip3 -- attribute of dnr result object
-
At most four integer IP addresses for this host. Unused entries are
zero. Valid only for address queries.
- cpuType -- attribute of dnr result object
-
- osType -- attribute of dnr result object
-
Textual strings giving the machine type an OS name. Valid for hinfo
queries.
- exchange -- attribute of dnr result object
-
The name of a mail-exchanger host. Valid for mx queries.
- preference -- attribute of dnr result object
-
The preference of this mx record. Not too useful, since the Macintosh
will only return a single mx record. Mx queries only.
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)
Prev: macdnr
Up: macdnr
Top: Top