dovedns

DoveDNS is a library for interfacing with Linode DNSManager, using Twisted.


Keywords
twisted, linode, dns
License
Other
Install
pip install dovedns==1.0.1

Documentation

DoveDNS

DoveDNS is a library for interfacing with Linode DNSManager, using Twisted.

Use

DoveDNS mostly follows the API docs at https://www.linode.com/api/dns, just with underscores instead of periods.

To use, simply import dovedns.DNSManager and create a DNSManager instance with your API key as the argument. Then, using your DNSManager instance, use the methods as outlined in the Linode API docs, but with underscores instead of periods (eg. domain.resource.create is domain_resource_create).

When creating the DNSManager instance, keyword argument apipath sets the API path, in case it changes, and debug, when set to True, will print the list of params it is passing to the Linode API server

The required arguments for each method are in the order as shown in the docs, with keyword arguments being the same capitalisation as in the docs.

Successful operations will return the DATA object as a Python object. Failed operations will return a Failure with the ERRORARRAY object in the exception.

Example

from twisted.internet import reactor
from dovedns import DNSManager

def _printnewresourceid(result):

    print result

    reactor.stop()

def _addsubdomain(result, DNS):

    for item in result:

        if item['DOMAIN'] == "example.com":

            d = DNS.domain_resource_create(item['DOMAINID'], "A", Target = "123.123.123.123", Name = "subdomain")
            d.addCallback(_printnewresourceid)
            return d

DNS = DNSManager("YOURAPIKEYHERE")
d = DNS.domain_list()
d.addCallback(_addsubdomain, DNS)

reactor.run()

Developing

If you notice something funny that's not my gleeful disregard of PEP8, send me a patch or a suggestion!