I am having a strange situation:
i am curling urls like this:
def check_urlstatus(url):
h = httplib2.Http()
try:
resp = h.request("http://" + url, 'HEAD')
if int(resp[0]['status']) < 400:
return 'ok'
else:
return 'bad'
except httplib2.ServerNotFoundError:
return 'bad'
if I try to test this with:
if check_urlstatus('.f.de') == "bad": #<--- error happening here
#..
#..
it is saying:
UnicodeError: label empty or too long
what is the problem i am causing here?
EDIT: here is the traceback with idna. I guess, it tries to split the input by .
and in this case, first label is empty which is the pace before the first .
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…