if theurl.startswith("http://"): theurl = theurl[7:]
head = theurl[:theurl.find('/')]
tail = theurl[theurl.find('/'):]
response_code = 0
import httplib
conn = httplib.HTTPConnection(head)
conn.request("HEAD",tail)
res = conn.getresponse()
response_code = int(res.status)
Traceback (most recent call last):
File "check_data_404.py", line 51, in <module>
run()
File "check_data_404.py", line 35, in run
res = conn.getresponse()
File "/usr/lib/python2.6/httplib.py", line 950, in getresponse
response.begin()
File "/usr/lib/python2.6/httplib.py", line 390, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.6/httplib.py", line 354, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine
Does anyone know what “Bad Status Line” is?
Edit: I tried this for many servers, and many URL’s and I still get this error?
From the documentation for httplib (Python 2) (called http.client in Python 3):
I ran the same code and did not receive an error:
I guess just double-check everything and try again?