Last active
October 28, 2016 05:09
-
-
Save cdodd/8845859 to your computer and use it in GitHub Desktop.
Revisions
-
Craig Dodd revised this gist
Feb 10, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,9 +13,9 @@ # Verify login status if response['status'] != 'success': sys.exit('Incorrect credentials') # Create a CNAME record response = rest_iface.execute( '/CNAMERecord/example.com/myapp.example.com.', 'POST', -
Craig Dodd revised this gist
Feb 6, 2014 . 1 changed file with 22 additions and 18 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,25 +1,29 @@ import sys from dynect.DynectDNS import DynectRest rest_iface = DynectRest() # Log in credentials = { 'customer_name': 'my_cust', 'user_name': 'my_user', 'password': 'my_pass', } response = rest_iface.execute('/Session/', 'POST', credentials) # Verify login status if response['status'] != 'success': sys.exit("Incorrect credentials") # Perform action response = rest_iface.execute( '/CNAMERecord/example.com/myapp.example.com.', 'POST', {'rdata': {'cname':'example.herokuapp.com.'}}, ) # Output response data print response['data'] # Destroy session rest_iface.execute('/Session/', 'DELETE') -
Craig Dodd revised this gist
Feb 6, 2014 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -12,14 +12,14 @@ dyn = DynectRest() creds = { 'customer_name': 'yourcustomer', 'user_name': 'youruser', 'password': 'yourpass', } def request_dyn(dyn, uri, method, args): response = dyn.execute(uri, method, args) if response['status'] != 'success': sys.exit('Error executing %s %s %s %s' % (uri, method, json.dumps(args), json.dumps(response))) request_dyn(dyn, '/CNAMERecord/example.com/myapp.example.com.','POST',{'rdata':{'cname':'example.herokuapp.com.'}}) -
Craig Dodd revised this gist
Feb 6, 2014 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,11 +4,10 @@ try: import json except ImportError: try: import simplejson as json except ImportError: sys.exit("Could not find json or simplejson libraries.") dyn = DynectRest() -
Craig Dodd created this gist
Feb 6, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ import sys from dynect.DynectDNS import DynectRest try: import json except ImportError: try: import simplejson as json except ImportError: sys.exit("Could not find json or simplejson libraries.") dyn = DynectRest() creds = { 'customer_name': 'yourcustomer', 'user_name': 'youruser', 'password': 'yourpass', } def request_dyn(dyn, uri, method, args): response = dyn.execute(uri, method, args) if response['status'] != 'success': sys.exit("Error executing " + uri + " " + method + " " + json.dumps(args) + " " + json.dumps(response)) request_dyn(dyn, '/CNAMERecord/example.com/myapp.example.com.','POST',{'rdata':{'cname':'example.herokuapp.com.'}})