This page looks best with JavaScript enabled

GoDaddy API with Python

 ·  🎃 kr0m

One of the most tedious tasks for a system administrator is managing DNS zones. Fortunately, most ISPs allow zone editing through APIs. In this article, we will learn how to manage domains contracted in GoDaddy through its API.

We access the GoDaddy APIs section:
https://developer.godaddy.com/keys/

If we already have configured APIs, something similar to this will appear, we click on Create New API Key:

We assign a descriptive name and indicate that it is a production key:

It will show us two fields, key/secret:

Finally, we can see the new key:

We install the Python libraries:

pip install godaddypy

We program a small script that will dump the contracted domains:

vi test.py

from godaddypy import Client, Account

daddyId = 'DADDY_ID'
daddyKey = 'DADDY_KEY'
daddySecret = 'DADDY_SECRET'

my_acct = Account(api_key=daddyKey, api_secret=daddySecret)
delegate_acct = Account(api_key=daddyKey, api_secret=daddySecret, delegate=daddyId)
client = Client(my_acct)
delegate_client = Client(delegate_acct)

domains = client.get_domains()
if domains:
 for domain in domains:
 print('-- Domain: %s' % domain)
else:
 print('-- No Domains found')

Le asignamos los permisos necesarios:

chmod 700 test.py

Probamos el script:

python3 test.py

-- Domain: DOMAIN1.com  
-- Domain: DOMAIN2.com
If you liked the article, you can treat me to a RedBull here