Skip to content

Instantly share code, notes, and snippets.

@hughsaunders
Last active December 11, 2015 09:19
Show Gist options
  • Save hughsaunders/4579344 to your computer and use it in GitHub Desktop.
Save hughsaunders/4579344 to your computer and use it in GitHub Desktop.
Delegating a subdomain with the Rackspace Cloud DNS API.
#!/usr/bin/env python
#Import clouddns module
import clouddns
#Authenticate to API
dns=clouddns.connection.Connection('YOUR RACKSPACE CLOUD USERNAME','YOUR API KEY')
#Get domain object
domain=dns.get_domain(name='wherenow.org')
#Add the necessary records
domain.create_record('he.wherenow.org','ns5.he.net','NS')
domain.create_record('he.wherenow.org','ns4.he.net','NS')
domain.create_record('he.wherenow.org','ns3.he.net','NS')
domain.create_record('he.wherenow.org','ns2.he.net','NS')
domain.create_record('he.wherenow.org','ns1.he.net','NS')
#Print all records now in the domain, to check the above were added successfully
for record in domain.get_records():
print record.type,record.name,record.data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment