コード例 #1
0
ファイル: daddy.py プロジェクト: PaulSidze/godaddyDDNS
def main():
    r = requests.get(config["public_ip"])
    current_ip = r.json()["ip"]
    my_acct = Account(api_key=config["key"], api_secret=config['secret'])
    client = Client(my_acct)
    my_domains = client.get_domains()
    daddy_ip = client.get_a_records(my_domains[0])[0]['data']
    if current_ip != daddy_ip:
        client.update_ip(current_ip, domains=[my_domains[0]])
    else:
        print "Your Public IP is %s and GoDaddy A record is %s for the domain %s" % (current_ip,daddy_ip, my_domains[0])
コード例 #2
0
def main():
    r = requests.get(config["public_ip"])
    current_ip = r.json()["ip"]
    my_acct = Account(api_key=config["key"], api_secret=config['secret'])
    client = Client(my_acct)
    my_domains = client.get_domains()
    daddy_ip = client.get_a_records(my_domains[0])[0]['data']
    if current_ip != daddy_ip:
        client.update_ip(current_ip, domains=[my_domains[0]])
    else:
        print "Your Public IP is %s and GoDaddy A record is %s for the domain %s" % (
            current_ip, daddy_ip, my_domains[0])
コード例 #3
0
MY_DOMAIN = config.get('AWS', 'MY_DOMAIN')
MY_SUBDOMAIN = config.get('AWS', 'MY_SUBDOMAIN')
current_record = ''

r = get(u'http://169.254.169.254/latest/meta-data/public-ipv4')
public_ip = r.text

logging.debug(u'Public IP of the AWS instance: ' + public_ip)

my_acc = Account(
    api_key = config.get('GoDaddy', 'api_key'),
    api_secret = config.get('GoDaddy', 'api_secret'))
                
client = Client(my_acc)

a_records = client.get_a_records(MY_DOMAIN)

for d in a_records:
    if d[u'name'] == MY_SUBDOMAIN:
        current_record = d[u'data']
        break

if current_record == '':
    logging.error(u'GoDaddy DNS record for subdomain not found')
    raise ValueError(u'I can\'t find current DNS record')
else:
    logging.debug(u'Current DNS record: ' + current_record)

if public_ip == current_record:
    logging.debug(u'Public IP and current DNS record are the same (not needed to update)')
else:
コード例 #4
0
MY_DOMAIN = config.get('AWS', 'MY_DOMAIN')
MY_SUBDOMAIN = config.get('AWS', 'MY_SUBDOMAIN')
current_record = ''

r = get(u'http://169.254.169.254/latest/meta-data/public-ipv4')
public_ip = r.text

logging.debug(u'Public IP of the AWS instance: ' + public_ip)

my_acc = Account(api_key=config.get('GoDaddy', 'api_key'),
                 api_secret=config.get('GoDaddy', 'api_secret'))

client = Client(my_acc)

a_records = client.get_a_records(MY_DOMAIN)

for d in a_records:
    if d[u'name'] == MY_SUBDOMAIN:
        current_record = d[u'data']
        break

if current_record == '':
    logging.error(u'GoDaddy DNS record for subdomain not found')
    raise ValueError(u'I can\'t find current DNS record')
else:
    logging.debug(u'Current DNS record: ' + current_record)

if public_ip == current_record:
    logging.debug(
        u'Public IP and current DNS record are the same (not needed to update)'