Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Use Twisted and dnspython to deal with DNS data.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.markdown
Octocat-spinner-32 setup.py
README.markdown

Twisted / DNS Python

txdnspython is a way to use dnspython to create and manipulate DNS messeages and then send those messages over the network using Twisted's asynchronous networking.

dnspython has two interfaces for sending DNS data over the network - dns.resolver.query and the tcp, udp, and xfr methods in the dns.query module. txdnspython currently can replace the dns.query.tcp and dns.query.udp methods from dnspython.

An Example

Here's an example of how to send a query (the code can be found in examples/simple_udp_query.py):

from twisted.internet import reactor

import txdnspython

import dns.message

def printresult(result):
    print result
    reactor.stop()

def printerror(reason):
    print reason
    reactor.stop()

client = txdnspython.UdpDnsClient(reactor, '8.8.8.8')

query_response = client.send_query(dns.message.make_query('www.google.com.', 'A'))
query_response.addCallback(printresult)
query_response.addErrback(printerror)
reactor.run()

Running the Examples

The example code can be run like this:

PYTHONPATH=src python examples/simple_udp_query.py

Generating API Documentation

From the root of the source tree run this command:

PYTHONPATH=src epydoc --html txdnspython

You'll need epydoc installed of course.

Something went wrong with that request. Please try again.