Skip to content

Instantly share code, notes, and snippets.

@dragosthealex
Created March 4, 2017 16:37
Show Gist options
  • Save dragosthealex/171249ba346c7b5aaa054ce008dfea9c to your computer and use it in GitHub Desktop.
Save dragosthealex/171249ba346c7b5aaa054ce008dfea9c to your computer and use it in GitHub Desktop.
Updates a GoDaddy DNS record (requires godaddypy module)
#!/usr/bin/python
import sys
import argparse
from godaddypy import Client, Account
KEY = 'my key'
SECRET = 'my secret'
def update(client, new_ip='127.0.0.1', domain_no=0):
dom = client.get_domains()[domain_no]
print(client.update_ip(new_ip, domains=[dom]))
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('ip', help='The ip to update the new record with.')
parser.add_argument('-r', help='The domain number (if you have multiple domains registered',
default=0, type=int)
args = parser.parse_args()
acc = Account(api_key=KEY, api_secret=SECRET)
client = Client(acc)
update(client, args.ip, args.r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment