0
파이썬에서 URL의 IP를 찾을 수있는 간단한 프로그램을 작성했습니다. 파이썬 : gethostbyname 오류
File "wexec.py", line 40, in hell
ipname = socket.gethostbyname('http://%s' % (hcon))
socket.gaierror: [Errno 11004] getaddrinfo failed
지금 내가 뭘 잘못했는지 모르겠지만 여기 내 기능의 코드입니다 : 당신이 볼 수 있듯이
def hell():
hcon = raw_input(Fore.RED + Style.BRIGHT + "Website: ")
h1 = httplib.HTTPConnection('http://%s:80' % (hcon))
urlopen = urllib.urlopen('http://%s:80' % (hcon))
ipname = socket.gethostbyname('http://%s' % (hcon))
print(strftime("[%H:%M:%S]", gmtime()) + " Found IP: %d " % (ipname))
enter = raw_input("Press enter or any other key to continue.")
hell()
나는이 오류가 발생합니다. 웹 사이트에 대한 HTTP 연결을 연 다음 urllibb로 URL을 열고 웹 사이트의 IP를받습니다. 그러나 당신이 볼 수 있듯이, 내가 뭘 잘못하고 있는지 모르겠습니다. 누군가 도울 수 있습니까?