• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

ADNS.pyH A D18-Nov-20132.1 KiB6952

DNSBL.pyH A D03-Dec-20132.6 KiB8266

GPLH A D18-Nov-201317.6 KiB341281

MANIFESTH A D03-Dec-2013128 1110

MANIFEST.inH A D18-Nov-201389 65

PKG-INFOH A D03-Dec-2013808 2219

READMEH A D18-Nov-20132.8 KiB10067

adnsmodule.cH A D03-May-202234.4 KiB1,2251,022

pymemcompat.hH A D18-Nov-20133.1 KiB8819

setup.pyH A D03-May-20221.9 KiB6042

README

1Build Instructions
2==================
3
4First, you gotta have the adns_ libraries installed somewhere. Maybe
5your OS vendor has it packaged already.
6
7.. _adns: http://www.chiark.greenend.org.uk/~ian/adns/
8
9For adns-python-1.2.0 and newer, you *must* have at least adns-1.2.
10
11Second, you gotta have Distutils_, which comes in Python 1.6 and up. If you
12have Python 1.5.2, *upgrade already*!
13
14.. _Distutils: http://www.python.org/sigs/distutils-sig/download.html
15
16Then, you can build and install::
17
18    $ python setup.py build
19    # python setup.py install # this is as root; use su or sudo
20
21Other useful things::
22
23    $ python setup.py bdist # make a binary distribution
24    $ python setup.py bdist_rpm # make an RPM
25
26RTFM for Distutils for more options.
27
28Usage
29=====
30
31See the included test programs for examples. A simple interactive
32example that uses synchronous queries::
33
34    >>> import adns
35    >>> s=adns.init()
36    >>> s.synchronous('python.org',adns.rr.MX)
37    (0, None, 1107034862, ((50, ('mail.python.org', 0,
38    ((2, '194.109.207.14'),))),))
39
40Results are generally returned as a 4-tuple: status, CNAME, expires, answer
41
42status is the adns status, enumerated in adns.status.
43
44CNAME is the CNAME of the answer, if any (None if the query target is not a
45CNAME)
46
47expires is the time (in ticks) that the answer's TTL expires.
48
49answer is what you really want. Since queries generally can return more than
50one answer, answer is returned as an n-tuple. The format of each item in the
51tuple depends on what type of RR was requested.::
52
53    >>> s.synchronous('python.org',adns.rr.MXraw)
54    (0, None, 1107034862, ((50, 'mail.python.org'),))
55
56In this case, MXraw returns only the MX data (priority and hostname). MX
57does further expansions upon the hostname, returning a tuple of hostname,
58status for the following data, and then a tuple of rr.ADDR answers, which
59are the address class and the IP address, i.e.::
60
61    >>> s.synchronous('mail.python.org',adns.rr.ADDR)
62    (0, None, 1107034862, ((2, '194.109.207.14'),))
63
64and compare to::
65
66    >>> s.synchronous('mail.python.org',adns.rr.A)
67    (0, None, 1107034862, ('194.109.207.14',))
68
69Prefer to use exceptions to processing status codes? adns.exception(status)
70will raise an appropriate exception. Sometimes you need to have the result,
71even when there is an exceptional condition. The exceptions are:
72
73* Error
74
75  * NotReadyError
76  * LocalError
77  * RemoteError
78
79    * RemoteConfigError
80    * RemoteFailureError
81    * RemoteTempError
82
83  * QueryError
84  * PermanentError
85
86    * NXDomain
87    * NoData
88
89For asynchronous examples, see ADNS.py, hostmx.py, and DNSBL.py.
90DNSBL.py is very outdated in terms of actual working blacklists,
91but may still be instructive.
92
93adns-python-1.2.0 and newer *requires* at least adns-1.2. For adns-1.1
94and older, use adns-python-1.1.1.
95
96:Author:
97	Andy Dustman <farcepest@gmail.com>
98:Date:
99	January 27, 2007
100