Exemple #1
0
def main():
    """ Find IPs from web host DNS and update godaddy DNS.
    """
    config = _config()

    resolver = Resolver()
    resolver.nameservers = config['initial_nameservers']
    LOG.debug("Resolving namdservers %s", config['nameservers'])
    nameservers = [resolver.address(_) for _ in config['nameservers']]

    resolver.nameservers = nameservers

    addresses = {}
    for domain in config['domains']:
        addresses[domain] = resolver.address(domain)
    LOG.debug("Found addresses: %s", addresses)

    account = Account(**config['credentials'])
    client = Client(account)
    domains = client.get_domains()

    for domain, address in addresses.items():
        if domain not in domains:
            raise ValueError("%s not in client list of domains" % domain)
        current = client.get_records(domain)[0]['data']
        if current != address:
            LOG.info('updating %s (%s -> %s)', domain, current, address)
            client.update_record_ip(address, domain, '@', 'A')
        else:
            LOG.info('Record up-to-date %s (%s)', domain, address)
    LOG.debug("complete")
Exemple #2
0
def update_dns_record(domain, record_type, record_name, ip_address, api_key,
                      api_secret, logger):

    userAccount = Account(api_key=api_key, api_secret=api_secret)
    userClient = Client(userAccount)

    records = userClient.get_records(domain,
                                     record_type=record_type,
                                     name=record_name)

    # dudes = [x["name"] for x in records_of_type_a]

    if not records:
        logger.error("No {} / {} record found to update.".format(
            record_type, record_name))
        return

    for record in records:
        logger.info("Updating record with name '{}'".format(record["name"]))
        result = userClient.update_record_ip(ip_address,
                                             domain,
                                             name=record["name"],
                                             record_type=record_type)
        logger.info("Updated '{}' with result : {}".format(
            record["name"], result))
Exemple #3
0
def update(config):
    public_ip = requests.get('http://ip.42.pl/raw').text

    account = Account(api_key=config.key, api_secret=config.secret)
    client = Client(account)

    record = client.get_records(config.domain, record_type='A')
    if record[0]['data'] != public_ip:
        print('Updating IP from {} to {}'.format(record[0]['data'], public_ip))
        client.update_ip(public_ip, domains=[config.domain])

    time.sleep(60)
Exemple #4
0
def main():
    pp = pprint.PrettyPrinter(indent=4)

    my_acct = Account(api_key=keyring.get_password('godaddy', 'apikey'), \
                api_secret=keyring.get_password('godaddy', 'apisecret'))
    client = Client(my_acct)

    domains = client.get_domains()
    print("{}".format(domains))

    for dom in domains:
        r = client.get_domain_info(dom)
        print("{}:".format(r['domain']), end=" ")
        if r['status'] == 'CANCELLED':
            cprint("{}".format(r['status']), "red")
        elif r['status'] == 'ACTIVE':
            cprint("{}".format(r['status']), "green")
            records = client.get_records(r['domain'])
            #pp.pprint(records)
            has_caa = False
            has_mxs = False
            has_soa = False
            has_cnames = False
            has_as = False
            has_nss = False
            for R in records:
                if R['type'] == 'A':
                    has_as = True
                elif R['type'] == 'SOA':
                    has_soa = True
                elif R['type'] == 'CAA':
                    has_caa = True
                elif R['type'] == 'CNAME':
                    has_cnames = True
                elif R['type'] == 'NS':
                    has_nss = True
                elif R['type'] == 'MX':
                    has_mxs = True
                else:
                    cprint("Unrecognized type: {}".format(R['type']), \
                            "magenta")
            print("\tA: {}, CNAME: {}, SOA: {}, CAA: {}, MX: {}, NS: {}"\
                    .format(has_as, has_cnames, has_soa, has_caa, has_mxs, \
                        has_nss))
        else:
            print("Unrecognized domain status: {}: {}".format(\
                r['domain'], r['status']))
Exemple #5
0
def main():
    account = Account(api_key=config.GODADDY_KEY,
                      api_secret=config.GODADDY_SECRET)
    client = Client(account)

    # Check that user owns the specified domain
    domains = client.get_domains()
    print("INFO: Checking target domain ownership.")
    if domains.count(config.GODADDY_DOMAIN) != 1:
        raise AssertionError("ERROR: User must own the domain specified.")

    print("INFO: Retrieving currentIP.")
    currentIP = client.get_records(
        config.GODADDY_DOMAIN, record_type="A", name="@")[0]["data"].strip()
    print("INFO: currentIP retrieved.")

    # main update loop
    while True:
        try:
            print("INFO: Retrieving publicIP.")
            publicIP = requests.get("http://ip.42.pl/raw").text.strip()
            print("INFO: publicIP retrieved.")
        except:
            print("ERROR: Could not fetch public IP!")

        print("INFO: Checking publicIP against currentIP")
        if publicIP != currentIP:
            print(
                f"INFO: IP out of date. Updating current IP to: {publicIP}.")
            try:
                client.update_ip(publicIP, domains=[
                    config.GODADDY_DOMAIN])
                currentIP = publicIP
                print(f"INFO: IP update successful.")
            except:
                print("ERROR: Could not update IP!")

        # Pause execution for UPDATE_INTERVAL seconds.
        time.sleep(config.UPDATE_INTERVAL)
Exemple #6
0
        update_now = True
else:
    update_now = True

if 'last_ip' in config:
    if my_ip != config['last_ip']:
        update_now = True

if update_now:
    my_acct = Account(api_key=config['key'], api_secret=config['secret_key'])
    client = Client(my_acct)

    domain = config['domain']
    sub = config['sub-domain']

    print(now.strftime('%Y-%m-%d %H:%M:%S.%f'))
    if not client.update_ip(my_ip, domains=[domain], subdomains=[sub]):
        print("ERROR UPDATING DOMAIN!")
    else:
        print("Domain updated successfully!")

    print("Current domain info:")
    print("\t{0}".format(client.get_records(domain)))

    config['last_update'] = now.strftime('%Y-%m-%d %H:%M:%S.%f')
    config['last_ip'] = my_ip

    with open(args.config, 'w') as f:
        json.dump(config, f, indent=2)

Exemple #7
0
import logging
import pif
from godaddypy import Client, Account

logging.basicConfig(filename='godaddy.log',
                    format='%(asctime)s %(message)s',
                    level=logging.INFO)

my_acct = Account(api_key='e52xSqLBxqDf_6LNm7ZQzA2gZtPioxPkynu',
                  api_secret='GqwcELGWrvChmkf83XtNan')
client = Client(my_acct)
public_ip = pif.get_public_ip('v4.ident.me')

for dominio in client.get_domains():
    records = client.get_records(dominio, record_type='A')
    logging.debug("Dominio '{0}' Registros DNS: {1}".format(
        dominio, records[0]['data']))
    actual_ip = records[0]['data']
    if public_ip != records[0]['data']:
        client.update_ip(public_ip, domains=dominio)
        client.update_record_ip(public_ip, dominio, 'dynamic', 'A')
        logging.info("Dominio '{0}' Ip Pública configurada a '{1}'".format(
            dominio, public_ip))

actual = client.get_records(dominio, record_type='A')
print("Configuración Final:")
print(actual)
api_key = "ENTER_API_KEY_HERE"
secret_key = "ENTER_SECRET_KEY_HERE"

domain = 'edennimni.me'

acc = Account(api_key=api_key, api_secret=secret_key)
client = Client(acc)

public_ipv4 = pif.get_public_ip()

if client is None:
    print("[] Could not open the specified account.")
if client.get_domains() is None:
    print("[] Could not edit an account with no domains available.")
if public_ipv4 is None:
    print("[] Could not fetch public ip, please try again later.")

try:
    for records in client.get_records(domain, record_type='A'):
        if public_ipv4 == records["data"]:
            print("[] IPv4 is already updated.")
        else:
            if client.update_record_ip(public_ipv4, domain, records["name"],
                                       'A'):
                print("[] IPv4 has been updated successfuly.")
            else:
                print("[] IPv4 has not been updated successfuly.")
except Exception as e:
    print(e)
    sys.exit()
LOG_FILE = script_dir + "/clean.log"

if os.path.exists(LOG_FILE):
    os.remove(LOG_FILE)

logging.basicConfig(format='%(levelname)-8s [%(asctime)s] %(message)s',
                    level=logging.ERROR,
                    filename=LOG_FILE)

try:
    my_acct = Account(api_key=API_KEY, api_secret=API_SECRET)
    client = Client(my_acct)
except Exception as err:
    logging.error(f"Account config error: {err}")


def findTXTID(data):
    ids = []
    for record in data:
        if "_acme-challenge" in record['name']:
            ids.append(record['name'])
    return ids


try:
    records = client.get_records(CERTBOT_DOMAIN, record_type='TXT')
    results = findTXTID(records)
    for result in results:
        client.delete_records(CERTBOT_DOMAIN, name=result)
except Exception as err:
    logging.error(f"client.delete_records error: {err}")
    sys.exit(0)

# Remember to set your parameters
paramAPIKEY = 'godaddy api key'
paramAPISECRET = 'godaddy api secret'
paramDNSNAME = 'dnsrecord name'  # for wildcard = _acme-challenge'

userAccount = Account(api_key=paramAPIKEY, api_secret=paramAPISECRET)
userClient = Client(userAccount)

domain = certDOMAIN
n_record = paramDNSNAME
v_record = certVALIDATION

try:
    records = userClient.get_records(domain, name=n_record, record_type='TXT')
    print(records)
    if len(records) == 0:
        userClient.add_record(domain, {
            'data': v_record,
            'name': n_record,
            'ttl': 600,
            'type': 'TXT'
        })
    records = userClient.get_records(domain, name=n_record, record_type='TXT')
    for record in records:
        if v_record != record["data"]:
            updateResult = userClient.update_record(domain, {
                'data': v_record,
                'name': n_record,
                'ttl': 600,
Exemple #11
0
import socket
from godaddypy import Client, Account

ip_addr = "114.114.114.114"
api_url = 'https://api.godaddy.com/v1/domains/wangxidi.xyz/records'

my_acct = Account(api_key='9ZpSAWHNdgi_9AhPY28hRQ8pheBoNarWk',
                  api_secret='MYBoT7zYoSxRNV4v91Z4CN')
client = Client(my_acct)


def get_host_ip():
    """
    查询本机ip地址
    :return:
    """
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(('8.8.8.8', 80))
        ip = s.getsockname()[0]
    finally:
        s.close()

    return ip


client.update_ip(get_host_ip(), domains=['wangxidi.xyz'])

r = client.get_records('wangxidi.xyz', record_type='A')
print(r)
Exemple #12
0
class GodaddyApi:
    def __init__(self, api_key, api_secret):
        self.api_key = api_key
        self.api_secret = api_secret
        my_acct = Account(api_key, api_secret)
        self.__client = Client(my_acct)
        self.Authorization = "sso-key %s:%s" % (self.api_key, self.api_secret)
        self.headers = {"Authorization": self.Authorization, "accept": "application/json","Content-Type": "application/json"}

    def domain_list(self):
        Authorization = "sso-key %s:%s" % (self.api_key, self.api_secret)
        headers = {"Authorization": Authorization}
        all_domain = []
        status = True
        marker = ""
        while True:
            url = 'https://api.godaddy.com/v1/domains?limit=1000&marker={}'.format(marker)
            r = requests.get(url, headers=headers)
            status = True if r.json() else False
            if not status: break
            for domain in r.json():
                all_domain.append(domain['domain'])
                marker = domain['domain']
        return all_domain

    def domain_info(self, domain):
        '''
        :param domain: get "domain" information.
        :return: dict
        '''
        return self.__client.get_domain_info(domain)
        # return self.__client.get_domain_info(domain)['expires']
        # return self.__client.get_domain_info(domain)['nameServers']

    def record_list(self, domain):
        '''
        :param domain: get "domain" records.
        :return: list, each one record is a dict, include 'data' 'name' 'ttl' and 'type' field.
        '''
        return self.__client.get_records(domain)

    def record_create(self,domain,data,name,type):
        data_dict = [{"data": data, "name": name, "ttl": 3600, "type": type}]
        data_dict_json = json.dumps(data_dict)
        Authorization = "sso-key %s:%s" % (self.api_key, self.api_secret)
        headers = {"Authorization": Authorization,"accept": "application/json","Content-Type": "application/json"}
        url = "https://api.godaddy.com/v1/domains/{}/records".format(domain)
        r = requests.patch(url,data_dict_json,headers=headers)
        return r.status_code

    def record_edit(self,domain, data, record_type=None, name=None):
        data_dict = [{"data":data}]
        data_dict_json = json.dumps(data_dict)
        url = "https://api.godaddy.com/v1/domains/{}/records/{}/{}".format(domain,record_type,name)
        r = requests.put(url,data_dict_json,headers=self.headers)
        return r.status_code

    #获取单个记录的值,也用来判断记录是否存在
    def get_record(self,domain,record,type):
        """
        返回的结果为[{'data': '42.97.23.79', 'name': 'test2', 'ttl': 600, 'type': 'A'}]这种数据结构
        """
        url = "https://api.godaddy.com/v1/domains/{}/records/{}/{}".format(domain,type,record)
        r = requests.get(url,headers=self.headers)
        return r.json()

    def record_delte(self,domain,record_name):
        self.__client.delete_records(domain,record_name)

    def edit_ns(self,domain,nameservers):
        """nameservers为列表,元素为需要设置的nameserver域名"""
        data = {"locked":True,"nameServers":nameservers,"renewAuto":False}
        url = "https://api.godaddy.com/v1/domains/{}".format(domain)
        r = requests.patch(url,data=json.dumps(data),headers=self.headers)
        return r.text
        userAccount = Account(api_key=api_key, api_secret=api_secret)
        userClient = Client(userAccount)
        publicIP = pif.get_public_ip('ident.me')

        print('--------------------')
        print(datetime.now())
        print(publicIP)

        if (publicIP != lastIP and sendmail == True):
            sendMail(publicIP, mailFrom, mailTo)

        # subdomains_tmp will contain the subdomains to be created
        # after the current registered subdomains are updated
        subdomains_tmp = list(subdomains)

        records = userClient.get_records(domain, record_type=record_type)
        for record in records:
            if record["name"] in subdomains:
                print(record["name"])
                subdomains_tmp.remove(record["name"])
                if publicIP == record["data"]:
                    updateResult = True
                else:
                    updateResult = userClient.update_record_ip(
                        publicIP,
                        domain,
                        name=record["name"],
                        record_type=record_type)
                    print('Registry updated.')

                if updateResult != True:
Exemple #14
0
domain = 'example.com'
a_record = 'www'
date = strftime("%d/%m/%Y %H:%M:%S")

userAccount = Account(api_key='YOUR_KEY', api_secret='YOUR_SECRET')
userClient = Client(userAccount)
publicIP = pif.get_public_ip('ident.me')

# This fix an issue when the IP address cannot be retreived
if publicIP is None or publicIP is False:
    print(date + ' Unable to retrieve an IP from pif, exiting... ' + domain +
          ' record ' + a_record)
    sys.exit()

try:
    records = userClient.get_records(domain, name=a_record, record_type='A')
    for record in records:
        if publicIP != record["data"]:
            updateResult = userClient.update_record_ip(publicIP, domain,
                                                       a_record, 'A')
            if updateResult is True:
                print(date + ' Update for the domain ' + domain + ' record ' +
                      a_record + ' was ended with no Exception.')
        else:
            print(date + ' No DNS update needed for the domain ' + domain +
                  ' record ' + a_record)
except:
    print(sys.exc_info()[1])
    sys.exit()
#!/usr/bin/env python

import os, sys
import json

from godaddypy import Client, Account

DOMAIN = os.environ['DOMAIN']
my_acct = Account(api_key=os.environ['GODADDY_KEY'],
                  api_secret=os.environ['GODADDY_SECRET'])
client = Client(my_acct)
records = client.get_records(DOMAIN)
json.dump(records, sys.stdout)
class GoDaddy:
    def __init__(self, **config):
        self.domain_name = config.get('domain_name')
        self.alias_name = config.get('alias_name')
        self.__access_id = config.get('access_id')
        self.acct = Account(api_key=self.__access_id,
                            api_secret=config.get('access_key'))
        self.__client = Client(self.acct)

    def describe_record(self, *args, **kwargs):
        return self.__client.get_records(kwargs.get('domain_name'),
                                         record_type=kwargs.get('domain_type'),
                                         name=kwargs.get('domain_rr'))

    def add_record(self, *args, **kwargs):
        params = dict(name=kwargs.get('domain_rr'),
                      data=kwargs.get('domain_value'),
                      type=kwargs.get('domain_type'),
                      ttl=int(kwargs.get('domain_ttl')))

        result_data = self.__client.add_record(kwargs.get('domain_name'),
                                               params)
        if result_data is True:
            result_data = str(uuid())
        return result_data

    def update_record(self, *args, **kwargs):
        params = dict(name=kwargs.get('domain_rr'),
                      data=kwargs.get('domain_value'),
                      type=kwargs.get('domain_type'),
                      ttl=int(kwargs.get('domain_ttl')))
        result_data = self.__client.update_record(kwargs.get('domain_name'),
                                                  params)
        return result_data

    def remark(self, *args, **kwargs):
        return dict(code=0, msg='GoDaddy不支持修改')

    def set_record_status(self, *args, **kwargs):
        if kwargs.get('status') in ['开启', '启用', 'Enable', 'enable', 'ENABLE']:
            self.add_record(**kwargs)
        elif kwargs.get('status') in ['暂停', '禁用', 'disable']:
            self.del_record(**kwargs)
        else:
            return False
        return True

    def del_record(self, *args, **kwargs):
        domain_name = kwargs.get('domain_name')
        name = kwargs.get('domain_rr')
        record_type = kwargs.get('domain_type')
        result_data = self.__client.delete_records(domain_name,
                                                   name,
                                                   record_type=record_type)
        return result_data

    def describe_domains(self):
        domain_list = self.__client.get_domains()
        if not domain_list: return False
        for domain in domain_list:
            domain_info_list = self.__client.get_domain_info(domain)
            domain_info_list['records'] = len(
                self.__client.get_records(domain))
            yield domain_info_list

    def record_generator(self, **domain):
        record_info_list = self.__client.get_records(domain.get('domain'))
        if not record_info_list: return False
        for record in record_info_list:
            yield dict(domain_name=domain.get('domain'), data_dict=record)
logger.debug("Decrypting access key")
access_key = decrypt_key(AKEY, AKEY_FILE)
logger.debug("Decrypting secret key")
secret_key = decrypt_key(SKEY, SKEY_FILE)

#Set account information for GoDaddy API call
my_acct = Account(api_key=access_key, api_secret=secret_key)
client = Client(my_acct)

#Get public IP
logger.debug('Getting Public IP address of local network')
public_ip = get_public_ip()

#Get current DNS record
logger.debug("Getting current DNS record from GoDaddy")
dns_record = client.get_records(DOMAIN, record_type='A', name=DOMAIN_NAME)
godaddy_dns = dns_record[0]['data']

#Update DNS record only if public ip doesn't match DNS record
logger.debug(
    "Checking if Public IP matches GoDaddy DNS record and updating if not")
if godaddy_dns != public_ip:
    client.update_record_ip(public_ip, DOMAIN, DOMAIN_NAME, 'A')
    logger.info(
        "Updated Public IP address in GoDaddy from {0} to {1}. ".format(
            godaddy_dns, public_ip))
else:
    logger.info(
        'Public IP address {0} did not change. GoDaddy DNS was not updated & DNS IP address is still: {1}'
        .format(public_ip, godaddy_dns))
Exemple #18
0
#!/usr/bin/python
import sys, pif, datetime, time, logging
from godaddypy import Client, Account
class Unbuffered(object):
   def __init__(self, stream):
       self.stream = stream
   def write(self, data):
       self.stream.write(data)
       self.stream.flush()
   def writelines(self, datas):
       self.stream.writelines(datas)
       self.stream.flush()
   def __getattr__(self, attr):
       return getattr(self.stream, attr)
sys.stdout = Unbuffered(sys.stdout)

while (1):
	try:
		nowtime = datetime.datetime.now()
		my_acct = Account(api_key='KEY', api_secret='SECRET')
		client = Client(my_acct)
		pubip = pif.get_public_ip()
		godaddydns = client.get_records("DOMAIN.COM")[-1]['data']
		if pubip != godaddydns:
			client.update_ip(pubip, domains=['pickel.me'])
			print( "{} :: DNS Record updated [{}]".format(nowtime, pubip))
		# else:
			# print("{} :: DNS Record is already updated".format(nowtime))
		time.sleep(60)
	except:
		None
Exemple #19
0
try:
    logger.debug('Getting Public IP')
    publicIP = get_public_ip()
    logger.info('Got Public IP: ' + publicIP)

except Exception as e:
    logger.error('Error Getting Public IP: ' + e.__str__())
    sys.exit()

for DOMAIN in DOMAINS:
    try:
        logger.debug('Getting GoDaddy Records for ' + DOMAIN[1])
        godaddy_acct = Account(api_key=API_KEY, api_secret=API_SECRET)
        client = Client(godaddy_acct)
        records = client.get_records(DOMAIN[1], record_type=RECORD_TYPE, name=RECORD_NAME)
        try:
            for record in records:
                if publicIP != record["data"]:
                    updateResult = client.update_record_ip(publicIP, DOMAIN[1], name=RECORD_NAME,
                                                           record_type=RECORD_TYPE)
                    if updateResult is True:
                        logger.info('DNS Record Updated for ' + DOMAIN[1] + ':' + record["data"] + ' to ' + publicIP)
                else:
                    logger.info('DNS Record Update not Needed for ' + DOMAIN[1] + ':' + publicIP)

        except Exception as e:
            logger.error('Error Trying to Update DNS Record' + e.__str__())
            sys.exit()

    except Exception as e:
Exemple #20
0
    print("------")

for x in running_instances:
    print(x.network_interfaces_attribute[0]['Ipv6Addresses'])

# values before start:
# (update) Tims-MacBook-Pro-2:godaddy tim$ python x.py
# ['iotaa.co', 'iotaa.co.uk', 'iotaa.org']
# [{'type': 'A', 'name': '@', 'data': '139.59.135.120', 'ttl': 600}, {'type': 'A', 'name': 'demo', 'data': '192.168.43.20', 'ttl': 600}, {'type': 'A', 'name': 'hubcentral', 'data': '52.56.237.214', 'ttl': 3600}]

client = Client(
    Account(api_key=os.environ['godaddy_key'],
            api_secret=os.environ['godaddy_secret']))

print(client.get_domains())
print(client.get_records("iotaa.co.uk", record_type="A"))

# coote.org: temp for cert signing with letsencrypt
# print (client.update_record_ip ("87.81.133.180", "iotaa.co.uk", "demo", "A"))
# ip address handed out by hotspot on phone
# print (client.update_record_ip ("192.168.43.20", "iotaa.co.uk", "demo", "A"))
# an ec2 instance
print(client.update_record_ip("35.177.48.101", "iotaa.co.uk", "demo", "A"))

for ri in running_instances:
    print(
        client.update_record_ip("{}".format(ri.public_ip_address),
                                "iotaa.co.uk", "jenkins", "A"))

print(client.get_records("iotaa.co.uk", record_type="A"))
Exemple #21
0
    key = f.read()

#create godaddy object used for retrieving dns info and updating
if secret is not None and key is not None:
    account = Account(api_key=key, api_secret=secret)
else:
    raise Exception('api secret or key was None')

client = Client(account)

#infinite loop to check if the dynamic ip has changed, and if so then update dns records
while True:
    #get the current public ip
    ip = urllib.request.urlopen('https://ident.me').read().decode('utf8')
    for domain in domains:
        record = client.get_records(domain, record_type='A', name='@')
        current_ip = record[0].get('data')
        if current_ip != ip:
            result = client.update_record_ip(ip, domain, '@', 'A')
            if result:
                print('Update successful!')
            else:
                print('error')
        else:
            print('nothing to update')
    time.sleep(5)




domain_list = os.environ['GODADDY_DOMAIN_LIST'].split(',')
a_record_list = os.environ['GODADDY_A_RECORD_LIST'].split(',')
create_missing_records = os.environ.get('GODADDY_CREATE_MISSING_RECORDS', True)

userAccount = Account(api_key=key, api_secret=secret_key)
userClient = Client(userAccount)

publicIP = False
while not publicIP:
  publicIP = pif.get_public_ip()

for domain in domain_list:
  for a_record in a_record_list:
    print("Attemping update for: %s.%s" % (a_record, domain))
    try:
      records = userClient.get_records(domain, name=a_record, record_type='A')
      if len(records) == 0:
        print("No records returned for name.domain: %s.%s" % (a_record, domain))
        if create_missing_records:
          new_record =  {
                          "type": 'A',
                          "name": a_record,
                          "data": publicIP,
                          "ttl": 600,
                        }
          add_record_result = userClient.add_record(domain, new_record)
          if not add_record_result:
            print("ERROR - Unable to add missing A-record: %s.%s" % (a_record, domain))
          else:
            print("Successfully added missing A-Record: %s.%s" % (a_record, domain))
      for record in records:
Exemple #23
0
def get_godaddy_ip():
    godaddydomain = Account(api_key=godaddy_key, api_secret=godaddy_secret)
    client = Client(godaddydomain)
    r = client.get_records(domainname, record_type='A', name='@')
    return r