This page has documentation on pygodaddy, which is a python script to update the IPv4 address in Go Daddy's DNS. I installed this package on my CentOS machine using pip install pygodaddy. The documentation provides this example:
from pygodaddy import GoDaddyClient
client = GoDaddyClient()
if client.login(username, password):
print client.find_domains()
client.update_dns_record('sub.example.com', '1.2.3.4')
On my CentOS machine, I've created a file named godaddy.py, with the following. Note: The username and password provided are just for demonstation, and not my real username and password.
#!/usr/bin/env python
import pygodaddy
import logging
from pygodaddy import GoDaddyClient
client = GoDaddyClient()
logging.basicConfig(filename=/var/log/godaddy/godaddy.log, format='%(asctime)S %(message)s', level=logging.DEBUG)
if client.login('36524174', 'Bht45f!as34Ra'):
print client.find_domains()
client.update_dns_record('wima2.freekb.net', '12.34.56.78')
When typing python godaddy.py in the Terminal, nothing happens for a while, and then eventually this is displayed:
File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 487, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='dns.godaddy.com', port=443): Max retries exceeded with url: /default.aspx (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x176e350>: Failed to establish a new connection: [Errno 110] Connection timed out',))
I've disabled iptables. I've set the permissions of my script to 777, owned by root:root.
This post recommends adding sleep(int). I added sleep(1), yet I still get connection timed out.
#!/usr/bin/env python
import pygodaddy
import logging
import sleep
from pygodaddy import GoDaddyClient
client = GoDaddyClient()
logging.basicConfig(filename=/var/log/godaddy/godaddy.log, format='%(asctime)S %(message)s', level=logging.DEBUG)
if client.login('36524174', 'Bht45f!as34Ra'):
time.sleep(1)
print client.find_domains()
client.update_dns_record('wima2.freekb.net', '12.34.56.78')
Being relatively new to Python, I am not certain how to debug this connection issue.
EDIT: While I do have a proxy server in my LAN, I've configured my machines to not route traffic through my proxy server. On any machine in my LAN, Linux or Windows, I can ping dns.godaddy.com, and I get a response, with no packet loss, so I know I have the ability to talk to dns.godaddy.com. The python script uses port 443. If I attempt to telnet dns.godaddy.com 443, the connection times out.
telnet dns.godaddy.com 443
Trying 104.238.65.158. . .
telnet: Unable to connect to remote host: Connection timed out
I also tried using nmap to see the hops between my client and dns.godaddy.com. Much to my surprise, when tracing the route to dns.godaddy.com on port 443, the packets are able to hop all the way to dns.godaddy.com. I wonder why I get connection timed out with telnet and the python script, but nmap is able to "connect".
nmap -Pn --traceroute -p 443 dns.godaddy.com
Starting Nmap 6.40 ( http://nmap.org ) at 2017-01-02 19:17 CST
Nmap scan report for dns.godaddy.com (104.238.65.158)
Host is up (0.076s latency).
rDNS record for 104.238.65.158: ip-104-238-65-158.ip.secureserver.net
PORT STATE SERVICE
443/tcp filtered https
TRACEROUTE (using proto 1/icmp)
HOP RTT ADDRESS
1 4.67 ms r1.software.eng.us (192.168.0.1)
2 18.84 ms 142.254.152.173
3 35.83 ms ae62.applwibp02h.midwest.rr.com (24.164.240.217)
4 28.85 ms be22.gnfdwibb01r.midwest.rr.com (65.31.113.6)
5 30.93 ms bu-ether16.chcgildt87w-bcr00.tbone.rr.com (66.109.6.204)
6 33.18 ms bu-ether11.chctilwc00w-bcr00.tbone.rr.com (66.109.6.21)
7 77.75 ms 4.28.83.74
8 69.48 ms ip-184-168-0-117.ip.secureserver.net (184.168.0.117)
9 83.20 ms ip-104-238-65-158.ip.secureserver.net (104.238.65.158)