observerss / pygodaddy

3rd Party Client Library for Manipulating Go Daddy DNS Records.
https://pygodaddy.readthedocs.org/
Other
37 stars 30 forks source link

Quick Start #19

Open tolls101 opened 8 years ago

tolls101 commented 8 years ago

I installed pygodaddy and have no idea were to go from here. Where are the config changes made? What are the "quick start" directions telling me to do? I am lost like an Easter egg.

armando-fandango commented 8 years ago

after you have installed pygodaddy and pif, here is some sample code that I use:

!/usr/bin/env python

import logging import sys import pygodaddy import pif

if name == "main": logging.basicConfig(filename='godaddy-dyndns.log', format='%(asctime)s %(message)s', level=logging.INFO)

sys.stdout.write("username:") username = sys.stdin.readline().rstrip('\n') sys.stdout.write("password:") password = sys.stdin.readline().rstrip('\n') client = pygodaddy.GoDaddyClient() is_logged_in = client.login(username,password) if not is_logged_in: logging.error('Login failed !') sys.exit(1)

for domain in client.find_domains():

dns_records = list(client.find_dns_records(domain))

public_ip = pif.get_public_ip()

logging.info("Domain '{0}' DNS records: {1}".format(domain, dns_records))

if public_ip != dns_records[0].value:

domain = 'pv.armandology.com' client.update_dns_record(domain, public_ip) logging.info("Domain '{0}' public IP set to '{1}'".format(domain, public_ip))