Last active
December 11, 2015 09:19
-
-
Save hughsaunders/4579344 to your computer and use it in GitHub Desktop.
Delegating a subdomain with the Rackspace Cloud DNS API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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