powerdnsapi

About

powerdnsapi is an XMLRPC server for communicating with a database backend for PowerDNS.
It is written in Python and uses xmlrpclib. It is run as CGI, on Python 2.3 and MySQL 4.0 or newer. powerdnsapi is not affiliated or in any way a part of PowerDNS. It is written by Lasse Karstensen.

News

2008-01-27: Version 0.3 released. $GENERATE support. Add and remove (master) domains.

2008-01-22: Version 0.2 released. Rewrite into Python. Same featureset, cleaner code.
2008-01-07: Version 0.1 released. This is a prototype written in PHP. Feature set: List domains, fetch records, add/remove/change records.

Download

Downloads available at SourceForge.
Source code is also available in the subversion repository.

Resources


Planned features

The current version of powerdnsapi was written to be a server for dtext. It has only what was needed for that assignment.

Further planned features include:


Example

Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32) 
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlrpclib, pprint
>>> url = 'http://your-webserver/'
>>> rpc = xmlrpclib.ServerProxy(url)
>>> pprint.pprint(rpc.system.listMethods())
['domain_add',
 'domain_delete',
 'domain_get_records',
 'domain_list',
 'domain_raise_serial',
 'generate_add',
 'generate_delete',
 'generate_expand',
 'generate_list',
 'generate_update',
 'get_domain_from_id',
 'get_id_from_domain',
 'record_add',
 'record_delete',
 'record_update',
 'system.listMethods',
 'system.methodHelp',
 'system.methodSignature']
>>> 
>>> pprint.pprint( rpc.domain_list().items()[0] )
('1.2.3.in-addr.arpa',
 {'domainid': 202, 'notified_serial': '2007022101', 'serial': '2007022101'})
>>> 

>>> print len( rpc.domain_get_records(202))
247

>>> pprint.pprint( rpc.domain_get_records(202)[3])
{'comment': '',
 'content': 'some-webserver.hostname.com',
 'domain': 'hostname.com',
 'domain_id': '202',
 'id': '25001',
 'name': 'www',
 'prio': '0',
 'ttl': '86400',
 'type': 'CNAME'}
>>>
>>> rec = {'content': 'some-webserver.hostname.com', 'name': 'www-dev', 'type': 'CNAME', 'ttl': 3600, 'domain_id': 202 }
>>> rpc.add_record(rec)
>>> print len( rpc.domain_get_records(202))
248