asyncdns2


Nameasyncdns2 JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://alastairs-place.net/projects/asyncdns
SummaryPure Python asynchronous DNS via asyncio
upload_time2017-12-07 12:15:16
maintainer
docs_urlNone
authorAlastair Houghton
requires_python
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            asyncdns - Pure Python asynchronous DNS for asyncio
===================================================

.. image:: https://travis-ci.org/al45tair/asyncdns.svg?branch=master
    :target: https://travis-ci.org/al45tair/asyncdns

.. image:: https://readthedocs.org/projects/asyncdns/badge/?version=latest
    :target: http://asyncdns.readthedocs.io/en/latest/?badge=latest

What is this?
=============

``asyncdns`` is a pure Python asynchronous DNS resolver implementation written
on top of asyncio.  It doesn't require any external libraries, and it doesn't
use threads or blocking functions.

Usage
=====

``asyncdns`` doesn't have an equivalent to the widely used ``gethostbyname()``
or ``getaddrinfo()`` functions.  Instead, you use it by constructing a
``Query`` object specifying the DNS query you wish to run, then pass it to a
``Resolver`` to actually perform the query.

There are a handful of built-in resolvers, but for demonstration purposes the
easiest one to use is the ``SmartResolver``, which automatically makes use of
``/etc/hosts``, multicast DNS and regular DNS as appropriate.

For instance, do a simple lookup for an A record::

  >>> import asyncdns, asyncio
  >>> resolver = asyncdns.SmartResolver()
  >>> loop = asyncio.get_event_loop()
  >>> query = asyncdns.Query('www.example.com', asyncdns.A, asyncdns.IN)
  >>> f = resolver.lookup(query)
  >>> loop.run_until_complete(f)
  >>> print(f.result())
  ;; No error (RD, RA)
  ; 1 answers:
  www.example.com	54950	IN	A	93.184.216.34
  ; 0 authorities:
  ; 0 additional:

Note that you may or may not want to use ``SmartResolver`` in your code,
depending on your requirements - it probably isn't a good idea using multicast
DNS on an untrusted network, for instance.

            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "keywords": "", 
    "upload_time": "2017-12-07 12:15:16", 
    "author": "Alastair Houghton", 
    "home_page": "https://alastairs-place.net/projects/asyncdns", 
    "download_url": "https://pypi.python.org/packages/0b/73/59538c66c8cf8f45c501550ba03bc20bf5e19ac1b060ab4c36b2476f1669/asyncdns2-0.1.1.tar.gz", 
    "platform": "", 
    "version": "0.1.1", 
    "cheesecake_documentation_id": null, 
    "description": "asyncdns - Pure Python asynchronous DNS for asyncio\n===================================================\n\n.. image:: https://travis-ci.org/al45tair/asyncdns.svg?branch=master\n    :target: https://travis-ci.org/al45tair/asyncdns\n\n.. image:: https://readthedocs.org/projects/asyncdns/badge/?version=latest\n    :target: http://asyncdns.readthedocs.io/en/latest/?badge=latest\n\nWhat is this?\n=============\n\n``asyncdns`` is a pure Python asynchronous DNS resolver implementation written\non top of asyncio.  It doesn't require any external libraries, and it doesn't\nuse threads or blocking functions.\n\nUsage\n=====\n\n``asyncdns`` doesn't have an equivalent to the widely used ``gethostbyname()``\nor ``getaddrinfo()`` functions.  Instead, you use it by constructing a\n``Query`` object specifying the DNS query you wish to run, then pass it to a\n``Resolver`` to actually perform the query.\n\nThere are a handful of built-in resolvers, but for demonstration purposes the\neasiest one to use is the ``SmartResolver``, which automatically makes use of\n``/etc/hosts``, multicast DNS and regular DNS as appropriate.\n\nFor instance, do a simple lookup for an A record::\n\n  >>> import asyncdns, asyncio\n  >>> resolver = asyncdns.SmartResolver()\n  >>> loop = asyncio.get_event_loop()\n  >>> query = asyncdns.Query('www.example.com', asyncdns.A, asyncdns.IN)\n  >>> f = resolver.lookup(query)\n  >>> loop.run_until_complete(f)\n  >>> print(f.result())\n  ;; No error (RD, RA)\n  ; 1 answers:\n  www.example.com\t54950\tIN\tA\t93.184.216.34\n  ; 0 authorities:\n  ; 0 additional:\n\nNote that you may or may not want to use ``SmartResolver`` in your code,\ndepending on your requirements - it probably isn't a good idea using multicast\nDNS on an untrusted network, for instance.\n", 
    "lcname": "asyncdns2", 
    "bugtrack_url": null, 
    "github": false, 
    "name": "asyncdns2", 
    "license": "MIT License", 
    "summary": "Pure Python asynchronous DNS via asyncio", 
    "split_keywords": [], 
    "author_email": "alastair@alastairs-place.net", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2017-12-07T12:15:16", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/0b/73/59538c66c8cf8f45c501550ba03bc20bf5e19ac1b060ab4c36b2476f1669/asyncdns2-0.1.1.tar.gz", 
            "md5_digest": "fd84fbee81ee2ad51764bd0bcba395d3", 
            "downloads": 0, 
            "filename": "asyncdns2-0.1.1.tar.gz", 
            "packagetype": "sdist", 
            "path": "0b/73/59538c66c8cf8f45c501550ba03bc20bf5e19ac1b060ab4c36b2476f1669/asyncdns2-0.1.1.tar.gz", 
            "size": 19051
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}