阿莎,
在您回答这确实是您的网站后,我检查了为什么我得到一个空的 GoDaddy.com 页面。问题是您的 splitmyri.de 的 DNS 条目正在返回两个不同的 A 记录...
使用 107.10.141.119 分析结果:我的文件中的
硬编码允许我对 107.10.141.119 进行查询,它返回“这是我的站点” (然后我检查了http://splitmyri.de/terminal/并得到一个空json 哈希,mime 类型=[application/json])。检查此地址的反向条目会返回一个 Amazon AWS 主机(我期望真实网页的条目类型)。现在您上面的代码按预期工作......107.10.141.119 splitmyri.de
/etc/hosts
index.html
[mpenning@Bucksnort ~]$ python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.get('http://splitmyri.de/terminal/')
<Response [200]>
>>> requests.get('http://splitmyri.de/terminal/').content
u'{}'
>>> # requests.get('http://splitmyri.de/terminal/jfk').content returns a huge json hash
使用 68.178.232.100 分析结果:
对 68.178.232.100 的查询执行相同的演练会得到一个空的 GoDaddy.com 页面。反向映射此地址会显示停放域的典型条目。TooManyRedirects
正如您在尝试中看到的那样,在此处发送请求会返回...
[mpenning@Bucksnort ~]$ python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> foo = requests.get('http://splitmyri.de/terminal/jfk')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.linux-i686/egg/requests/api.py", line 50, in get
File "build/bdist.linux-i686/egg/requests/api.py", line 37, in request
File "build/bdist.linux-i686/egg/requests/sessions.py", line 170, in request
File "build/bdist.linux-i686/egg/requests/models.py", line 383, in send
File "build/bdist.linux-i686/egg/requests/models.py", line 210, in _build_response
requests.exceptions.TooManyRedirects
>>>
解决方案:
修复 splitmyri.de 的 DNS(删除 68.178.232.100 的 A 记录),一切都会好起来的。
包括下面的 DNS 信息作为仅供参考...
[mpenning@Bucksnort ~]$ dig splitmyri.de
; <<>> DiG 9.6-ESV-R4 <<>> splitmyri.de
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54051
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 4
;; QUESTION SECTION:
;splitmyri.de. IN A
;; ANSWER SECTION:
splitmyri.de. 3193 IN A 68.178.232.100
splitmyri.de. 3193 IN A 107.20.141.119
;; AUTHORITY SECTION:
splitmyri.de. 3193 IN NS ns49.domaincontrol.com.
splitmyri.de. 3193 IN NS ns50.domaincontrol.com.
;; ADDITIONAL SECTION:
ns49.domaincontrol.com. 3193 IN A 216.69.185.25
ns49.domaincontrol.com. 3193 IN AAAA 2607:f208:206::19
ns50.domaincontrol.com. 3193 IN A 208.109.255.25
ns50.domaincontrol.com. 3193 IN AAAA 2607:f208:302::19
;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Oct 26 05:14:51 2011
;; MSG SIZE rcvd: 205
[mpenning@Bucksnort ~]$
[mpenning@Bucksnort ~]$ dig -x 107.20.141.119
; <<>> DiG 9.6-ESV-R4 <<>> -x 107.20.141.119
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41049
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 6, ADDITIONAL: 6
;; QUESTION SECTION:
;119.141.20.107.in-addr.arpa. IN PTR
;; ANSWER SECTION:
119.141.20.107.in-addr.arpa. 300 IN PTR ec2-107-20-141-119.compute-1.amazonaws.com.
;; AUTHORITY SECTION:
141.20.107.in-addr.arpa. 900 IN NS pdns1.ultradns.net.
141.20.107.in-addr.arpa. 900 IN NS pdns2.ultradns.net.
141.20.107.in-addr.arpa. 900 IN NS pdns3.ultradns.org.
141.20.107.in-addr.arpa. 900 IN NS pdns5.ultradns.info.
141.20.107.in-addr.arpa. 900 IN NS pdns4.ultradns.org.
141.20.107.in-addr.arpa. 900 IN NS pdns6.ultradns.co.uk.
;; ADDITIONAL SECTION:
pdns1.ultradns.net. 86400 IN A 204.74.108.1
pdns1.ultradns.net. 86400 IN AAAA 2001:502:f3ff::1
pdns2.ultradns.net. 86400 IN A 204.74.109.1
pdns3.ultradns.org. 86400 IN A 199.7.68.1
pdns4.ultradns.org. 86400 IN A 199.7.69.1
pdns4.ultradns.org. 86400 IN AAAA 2001:502:4612::1
;; Query time: 306 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Oct 26 05:09:47 2011
;; MSG SIZE rcvd: 392
[mpenning@Bucksnort ~]$ dig -x 68.178.232.100
; <<>> DiG 9.6-ESV-R4 <<>> -x 68.178.232.100
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38578
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; QUESTION SECTION:
;100.232.178.68.in-addr.arpa. IN PTR
;; ANSWER SECTION:
100.232.178.68.in-addr.arpa. 3600 IN PTR parkwebwin-v01.prod.mesa1.secureserver.net.
;; AUTHORITY SECTION:
232.178.68.in-addr.arpa. 3600 IN NS cns1.secureserver.net.
232.178.68.in-addr.arpa. 3600 IN NS cns2.secureserver.net.
;; ADDITIONAL SECTION:
cns1.secureserver.net. 3600 IN A 208.109.255.100
cns2.secureserver.net. 3600 IN A 216.69.185.100
;; Query time: 173 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Oct 26 05:12:06 2011
;; MSG SIZE rcvd: 171
[mpenning@Bucksnort ~]$