finshes at 23:59:59 The library is available at: https://github.com/dyninc/Dynect-API-Python-Library ''' import sys import datetime import time import ConfigParser from optparse import OptionParser from DynectDNS import DynectRest import csv import StringIO dynect = DynectRest() def login(cust, user, pwd): ''' This method will do a dynect login @param cust: customer name @type cust: C{str} @param user: user name @type user: C{str} @param pwd: password @type pwd: C{str} @return: The function will exit the script on failure to login @rtype: None
''' import sys import ConfigParser from DynectDNS import DynectRest if (len(sys.argv) != 5): sys.exit("Incorrect Arguments. \n\nUsage: python UpdateGSLB.py zone fqdn region ip\n\n**If there is a space in region replace the space with %20") config = ConfigParser.ConfigParser() try: config.read('credentials.cfg') except: sys.exit("Error Reading Config file") dynect = DynectRest() # Log in arguments = { 'customer_name': config.get('Dynect', 'customer', 'none'), 'user_name': config.get('Dynect', 'user', 'none'), 'password': config.get('Dynect', 'password', 'none'), } response = dynect.execute('/Session/', 'POST', arguments) if response['status'] != 'success': sys.exit("Incorrect credentials") zone = sys.argv[1] fqdn = sys.argv[2] region = sys.argv[3]
''' import string import sys import ConfigParser from DynectDNS import DynectRest if (len(sys.argv) != 5): sys.exit("Incorrect Arguments. \n\nUsage: python UpdateRTTM.py zone fqdn region ip\n\n**If there is a space in region replace the space with %20") config = ConfigParser.ConfigParser() try: config.read('credentials.cfg') except: sys.exit("Error Reading Config file") dynect = DynectRest() # Log in arguments = { 'customer_name': config.get('Dynect', 'customer', 'none'), 'user_name': config.get('Dynect', 'user', 'none'), 'password': config.get('Dynect', 'password', 'none'), } response = dynect.execute('/Session/', 'POST', arguments) if response['status'] != 'success': sys.exit("Incorrect credentials") zone = sys.argv[1] fqdn = sys.argv[2] region = sys.argv[3]
''' import sys import ConfigParser from DynectDNS import DynectRest if (len(sys.argv) != 6): sys.exit("Incorrect Arguments. \n\nUsage: python UpdateGeoIP.py zone fqdn region ip countries\n") config = ConfigParser.ConfigParser() try: config.read('credentials.cfg') except: sys.exit("Error Reading Config file") dynect = DynectRest() # Log in arguments = { 'customer_name': config.get('Dynect', 'customer', 'none'), 'user_name': config.get('Dynect', 'user', 'none'), 'password': config.get('Dynect', 'password', 'none'), } dynect = DynectRest() response = dynect.execute('/Session/', 'POST', arguments) if response['status'] != 'success': sys.exit("Incorrect credentials")