我正在尝试使用 Python 的 liburl2 来访问此处记录的 Dreamhost API:http ://wiki.dreamhost.com/API
这是我的代码:
request = urllib2.Request('https://api.dreamhost.com/?key=<key>')
response = urllib2.urlopen(request)
page = response.read()
print(page)
这总是失败并出现错误:
urllib2.URLError: <urlopen error [Errno 104] Connection reset by peer>
我完全被难住了,因为我可以 ping api.dreamhost.com 就好了,而且 wget https://api.dreamhost.com/?key=也可以正常工作。
有任何想法吗?