How to automatically update your Go Daddy public IP address using godaddypy on Linux

Home > Search > How-to

If the IP address you lease from your ISP is dynamic (meaning it can change without warning), you would need to manually update your public IP address in the systems that contain your public IP address. To prevent downtime or outages, you can map your dynamic IP address to a hostname, such as You can sign up for a free account at, and then map your public IP address to a hostname.

Unfortunately, some systems do not accept a hostname. For example, if you rent a domain name from Go Daddy, your domain name must be pointed to an IP address. Go Daddy's system does not allow for hostnames. In this example, the following can be done to check your current IP address at intervals and to then update the public IP address on Go Daddy if the public IP address changes.

If using a Debian distribution:

[root@server1 ~]# apt-get install python
[root@server1 ~]# apt-get install python-pip
[root@server1 ~]# pip install pif
[root@server1 ~]# pip install godaddypy


If using a Red Hat distribution:

[root@server1 ~]# rpm -iUvh
[root@server1 ~]# yum install python
[root@server1 ~]# yum install python-pip
[root@server1 ~]# pip install pif
[root@server1 ~]# pip install godaddypy


The package will reside at /usr/lib/pythonx.x/site-packages/godaddypy. Ensure the latest version of godaddypy was installed. The versions are listed at

[root@server1 ~]# pip show godaddypy
. . .
Version: x.x.x


Request your API key:

  1. Sign into
  2. Select Create Key.
  3. Make note of the key and secret. Ensure the key is a Production key and not a Test key.


Create a new directory for the log file.

[root@server1 ~]# mkdir /var/log/godaddy


Create a file named in the /etc/cron.hourly directory and a file named go_daddy.log in the /var/log/godaddy directory.

[root@server1 ~]# touch /etc/cron.hourly/
[root@server1 ~]# touch /var/log/godaddy/go_daddy.log


The /etc/cron.hourly/ file will contain the Go Daddy key and secret.  Ensure root owns the file and only root has access to the file.

[root@server1 ~]# chown root:root /etc/cron.hourly/
[root@server1 ~]# chmod 700 /etc/cron.hourly/


Add the following to the file to update Go Daddy if your public IPv4 address changes.

#!/usr/bin/env python

import pif
import datetime
from godaddypy import Client, Account

my_acct = Account(api_key='PUBLIC_KEY', api_secret='SECRET_KEY')
client = Client(my_acct)
PUBLIC_IPV4 = pif.get_public_ip()
SUB1 = client.get_records(DOMAIN, record_type='A', name='sub1')[0]

if PUBLIC_IPV4 == SUB1['data']:
        log_file = open("/var/log/godaddy/go_daddy.log", "a")
        log_file.write("\n IPv4 address NOT updated ")
        client.update_record_ip(PUBLIC_IPV4, DOMAIN, name='sub1', record_type='A')
        log_file = open("/var/log/godaddy/go_daddy.log", "a")
        log_file.write("\n IPv4 address updated ")


Run the script, and then ensure text is written to the log file.

[root@server1 ~]# cat /var/log/godaddy/go_daddy.log IPv4 address not updated 2017-01-02 09:45:41


Add an entry in crontab to run the script once an hour.

1 * * * * python /etc/cron.hourly/


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.