I am trying to make scripts that check if many URLs exist:
import httplib with open('urls.txt') as urls: for url in urls: connection = httplib.HTTPConnection(url) connection.request("GET") response = connection.getresponse() if response.status == 200: print '[{}]: '.format(url), "Up!"
But I got this error:
Traceback (most recent call last): File "test.py", line 5, in <module> connection = httplib.HTTPConnection(url) File "/usr/lib/python2.7/httplib.py", line 693, in __init__ self._set_hostport(host, port) File "/usr/lib/python2.7/httplib.py", line 721, in _set_hostport raise InvalidURL("nonnumeric port: '%s'" % host[i+1:]) httplib.InvalidURL: nonnumeric port: '//globo.com/galeria/amazonas/a.html
What's wrong?
source share