Giter Site home page Giter Site logo

python-clouddns's Introduction

Python interface to Rackspace Cloud DNS

Homepage:https://github.com/chmouel/python-clouddns
Credits:Copyright 2011 Chmouel Boudjnah <[email protected]>
Licence:BSD

Usage

A Rackspace Cloud username and API key are required and can be obtained from http://manage.rackspacecloud.com.

Domains and records can be found by specifying their name or id. To enable debugging output for the HTTP connection, include the keyword argument debuglevel=1. Additional debugging output is available by setting the 'PYTHON_CLOUDDNS_DEBUG' environment variable.

List all domains:

#!/usr/bin/env python
import clouddns
dns = clouddns.connection.Connection('username','apikey')

for domain in dns.get_domains():
    print domain.name

Create a new domain:

#!/usr/bin/env python
import clouddns
dns = clouddns.connection.Connection('username','apikey')

dns.create_domain(name='1234-example.com', ttl=300,
                  emailAddress='[email protected]')

Import a domain from a BIND zone file or string:

#!/usr/bin/env python
import clouddns
dns = clouddns.connection.Connection('username','apikey')

with open('/tmp/example.com.zone', 'r') as f:
    dns.import_domain(f)

Update a domain:

#!/usr/bin/env python
import clouddns
dns = clouddns.connection.Connection('username','apikey')

domain = dns.get_domain(name='1234-example.com')
domain.update(ttl=600)

Delete a domain:

#!/usr/bin/env python
import clouddns
dns = clouddns.connection.Connection('username','apikey')

domain = dns.get_domain(name='1234-example.com')
dns.delete_domain(domain.id)

List all records for a domain:

#!/usr/bin/env python
import clouddns
dns = clouddns.connection.Connection('username','apikey')

domain = dns.get_domain(name='1234-example.com')
for record in domain.get_records():
    print '(%s) %s -> %s' % (record.type, record.name, record.data)

Create new record:

#!/usr/bin/env python
import clouddns
dns = clouddns.connection.Connection('username','apikey')

domain = dns.get_domain(name='1234-example.com')
domain.create_record('www.1234-example.com', '127.0.0.1', 'A')

Update a record:

#!/usr/bin/env python
import clouddns
dns = clouddns.connection.Connection('username','apikey')

domain = dns.get_domain(name='1234-example.com')
record = domain.get_record(name='www.1234-example.com')
record.update(data='10.1.1.1', ttl=600)

Delete a record:

#!/usr/bin/env python
import clouddns
dns = clouddns.connection.Connection('username','apikey')

domain = dns.get_domain(name='1234-example.com')
record = domain.get_record(name='www.1234-example.com')
domain.delete_record(record.id)

Alternative Geographic Endpoints

The examples above use the default authentication endpoint in the US. For UK accounts, you must override the authentication URL:

#!/usr/bin/env python
import clouddns
dns = clouddns.connection.Connection('username','apikey',
                                     authurl=clouddb.consts.uk_authurl)

GUI

A web based GUI is available here: https://github.com/rackerhacker/rackspace-clouddns-gui

python-clouddns's People

Contributors

chmouel avatar calebgroom avatar major avatar git-harry avatar adregner avatar pfarmer avatar

Watchers

James Cloos avatar Erik Redding avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.