if theurl.startswith(\"http://\"): theurl = theurl[7:] head = theurl[:theurl.find(\'/\')] tail = theurl[theurl.find(\'/\'):] response_code = 0 import httplib
I just found when we get exception httplib.BadStatusLine , is when server goes down and doesn't send any response, so it means web server doesn't even send the http code [1]
[1] http://en.wikipedia.org/wiki/List_of_HTTP_status_codes