if theurl.startswith(\"http://\"): theurl = theurl[7:]
head = theurl[:theurl.find(\'/\')]
tail = theurl[theurl.find(\'/\'):]
response_code = 0
import httplib
I recently got this error, in a situation where the method that contained the http request ran successfully once, and then threw this exception (with the status code as an empty string) the second time the method was called (with a different URL). I had a debugging advantage because this is calling my own REST api, so I did some logging on the server side and discovered that the request was never being received. I ultimately figured out that my URL string had a trailing newline character. So make sure that your URLs are stripped of any leading or trailing special characters.