ip - Python: gethostbyname error -


i coding simple program in python allows find ip of url. error:

file "wexec.py", line 40, in hell   ipname = socket.gethostbyname('http://%s' % (hcon)) socket.gaierror: [errno 11004] getaddrinfo failed 

now i'm not sure did wrong here functions code:

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 other key continue.")  hell() 

as can see. open http connection website , open url urllibb , ip of website. can see, i'm not sure i'm doing wrong. can help?

socket.gethostbyname() takes domain name, need drop 'http://' call. don't understand calls httplib , urllib doing, seem unnecessary snippet.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -