多くのURLが存在するかどうかを確認するスクリプトを実行しようとしています:
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!"
しかし、私はこのエラーが発生しました:
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
どうしたの?