This page有关于pygodaddy的文档,这是一个更新Go Daddy DNS中IPv4地址的python脚本。我使用 pip install pygodaddy 在我的CentOS机器上安装了这个软件包。文档提供了这个示例:
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')
在我的CentOS机器上,我创建了一个名为godaddy.py的文件,其中包含以下内容。注意:提供的用户名和密码仅用于演示,而不是我的真实用户名和密码。
#!/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')
在终端中输入 python godaddy.py 时,暂时没有任何反应,最后会显示:
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',))
我已禁用iptables。我已将我的脚本权限设置为777,由root拥有:root。
This post建议添加sleep(int)。我添加了sleep(1),但我仍然连接超时。
#!/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')
相对较新的Python,我不确定如何调试此连接问题。
修改: 虽然我的局域网中有代理服务器,但我已经将我的机器配置为不通过我的代理服务器路由流量。在我的局域网,Linux或Windows中的任何一台机器上,我都可以ping通dns.godaddy.com,我收到回复,没有数据包丢失,所以我知道我有能力与dns.godaddy.com交谈。 python脚本使用端口443.如果我尝试telnet dns.godaddy.com 443,连接超时。
telnet dns.godaddy.com 443
Trying 104.238.65.158. . .
telnet: Unable to connect to remote host: Connection timed out
我也尝试使用nmap查看我的客户端和dns.godaddy.com之间的跃点。令我惊讶的是,当在443端口跟踪到dns.godaddy.com的路由时,数据包能够一直跳到dns.godaddy.com。我想知道为什么我用telnet和python脚本连接超时,但是nmap能够“连接”。
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)
答案 0 :(得分:0)
看起来pygodaddy脚本不再正常工作,如此处所示:https://github.com/observerss/pygodaddy/issues/22。其他人则使用了godaddypy脚本。