A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-June/036605.html below:

[Python-Dev] Proposed DNS query library

[Python-Dev] Proposed DNS query library [Python-Dev] Proposed DNS query libraryBob Halley halley@play-bow.org
28 Jun 2003 20:15:10 -0700
"John D." <lists@webcrunchers.com> writes:

> Python has everything else, but it doesn't have a nameserver lookup
> class.  I propose creating a library which will perform the
> equivalent of the "dig" or "nslookup" commands. My own application
> is using it to query a DNS for mx records as a preface to using
> smtplib. (Perhaps this should be added to smtplib?)

> Is this a good idea or do I need to spend more time in the oven?
> (or worse, it already exists and I overlooked it?)

My dnspython package ( http://www.dnspython.org ) can do this, and a
lot more.  Here's a program which gets and prints MX records.

        import dns.resolver

        answers = dns.resolver.query('dnspython.org', 'MX')
        for rdata in answers:
            print 'Host', rdata.exchange, 'has preference', rdata.preference

/Bob



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4