0
我试图编写一个代码,这将能够通过whois.domaintools.com验证域。如何从一个具体的URL(python)获得正确的HTML代码
但是,阅读html时遇到的问题与whois.domaintools.com/notregistereddomain.com源代码不匹配。怎么了?它的要求或什么问题?我真的不知道如何解决它。
import urllib2
def getPage():
url="http://whois.domaintools.com/notregistereddomain.com"
req = urllib2.Request(url)
try:
response = urllib2.urlopen(req)
return response.read()
except urllib2.HTTPError, error:
print "error: ", error.read()
a = error.read()
f = open("URL.txt", "a")
f.write(a)
f.close()
if __name__ == "__main__":
namesPage = getPage()
print namesPage