从httplib(Python
2)的文档(在Python
3中称为http.client)中:
例外
httplib.BadStatusLine:( 例外http.client.BadStatusLine:)的子类
HTTPException。在服务器响应我们不理解的HTTP状态代码时引发。
我运行了相同的代码,但未收到错误:
>>> theurl = 'http://www.garageband.com/mp3cat/.UZCKbS6N4qk/01_Saraenglish.mp3'>>> if theurl.startswith("http://"):... theurl = theurl[7:]... head = theurl[:theurl.find('/')]... tail = theurl[theurl.find('/'):]... >>> head'www.garageband.com'>>> tail'/mp3cat/.UZCKbS6N4qk/01_Saraenglish.mp3'>>> response_pre = 0>>> import httplib>>> conn = httplib.HTTPConnection(head)>>> conn.request("HEAD", tail)>>> res = conn.getresponse()>>> res.status302>>> response_pre = int(res.status)我想只是仔细检查所有内容,然后重试?



