1Metadata-Version: 1.1
2Name: aiodns
3Version: 1.1.1
4Summary: Simple DNS resolver for asyncio
5Home-page: http://github.com/saghul/aiodns
6Author: Saúl Ibarra Corretgé
7Author-email: saghul@gmail.com
8License: UNKNOWN
9Description: ===============================
10        Simple DNS resolver for asyncio
11        ===============================
12
13        .. image:: https://secure.travis-ci.org/saghul/aiodns.png?branch=master
14            :target: http://travis-ci.org/saghul/aiodns
15
16        aiodns provides a simple way for doing asynchronous DNS resolutions
17        with a synchronous looking interface by using `pycares <https://github.com/saghul/pycares>`_.
18
19
20        Example
21        =======
22
23        ::
24
25            import asyncio
26            import aiodns
27
28            loop = asyncio.get_event_loop()
29            resolver = aiodns.DNSResolver(loop=loop)
30            f = resolver.query('google.com','A')
31            result = loop.run_until_complete(f)
32            print(result)
33
34
35        The following query types are supported: A, AAAA, CNAME, MX, NAPTR, NS, PTR, SOA, SRV, TXT.
36
37        The library supports both *asyncio* and *Trollius*.
38
39        If you use Python 3 you may use `yield from` statement::
40
41            @asyncio.coroutine
42            def func():
43                result = yield from resolver.query('google.com','A')
44
45        For Trollius you should use another syntax like::
46
47            @trollius.coroutine
48            def func():
49                 result = yield trollius.From(resolver.query('google.com','A'))
50
51        API
52        ===
53
54        The API is pretty simple, three functions are provided in the ``DNSResolver`` class:
55
56        * ``query(host, type)``: Do a DNS resolution of the given type for the given hostname. It returns an
57          instance of ``asyncio.Future``. The actual result of the DNS query is taken directly from pycares.
58          As of version 1.0.0 of aiodns (and pycares, for that matter) results are always namedtuple-like
59          objects with different attributes. Please check `the documentation <http://pycares.readthedocs.org/en/latest/channel.html#pycares.Channel.query>`_
60          for the result fields.
61        * ``gethostbyname(host, socket_family)``: Do a DNS resolution for the given
62          hostname and the desired type of address family (i.e. ``socket.AF_INET``).
63          While ``query()`` always performs a request to a DNS server,
64          ``gethostbyname()`` first looks into ``/etc/hosts`` and thus can resolve
65          local hostnames (such as ``localhost``).  Please check `the documentation
66          <http://pycares.readthedocs.io/en/latest/channel.html#pycares.Channel.gethostbyname>`_
67          for the result fields. The actual result of the call is a ``asyncio.Future``.
68        * ``cancel()``: Cancel all pending DNS queries. All futures will get ``DNSError`` exception set, with
69          ``ARES_ECANCELLED`` errno.
70
71
72        Running the test suite
73        ======================
74
75        To run the test suite: ``python test_aiodns.py``
76
77
78        Author
79        ======
80
81        Saúl Ibarra Corretgé <saghul@gmail.com>
82
83
84        License
85        =======
86
87        aiodns uses the MIT license, check LICENSE file.
88
89
90        Python versions
91        ===============
92
93        Python >= 3.4 is natively supported. Python 3.3 supported using the `asyncio package <https://pypi.python.org/pypi/asyncio>`_.
94        Older Python versions(2.6 - 3.2) are supported using `trollius <https://pypi.python.org/pypi/trollius>`_.
95
96
97        Contributing
98        ============
99
100        If you'd like to contribute, fork the project, make a patch and send a pull
101        request. Have a look at the surrounding code and please, make yours look
102        alike :-)
103
104
105Platform: POSIX
106Platform: Microsoft Windows
107Classifier: Development Status :: 5 - Production/Stable
108Classifier: Intended Audience :: Developers
109Classifier: License :: OSI Approved :: MIT License
110Classifier: Operating System :: POSIX
111Classifier: Operating System :: Microsoft :: Windows
112Classifier: Programming Language :: Python
113Classifier: Programming Language :: Python :: 2
114Classifier: Programming Language :: Python :: 2.6
115Classifier: Programming Language :: Python :: 2.7
116Classifier: Programming Language :: Python :: 3
117Classifier: Programming Language :: Python :: 3.0
118Classifier: Programming Language :: Python :: 3.1
119Classifier: Programming Language :: Python :: 3.2
120Classifier: Programming Language :: Python :: 3.3
121Classifier: Programming Language :: Python :: 3.4
122Classifier: Programming Language :: Python :: 3.5
123