I was thinking that, if I access a password protected site using python's mechanism, I would get a 401 Unauthorized error which needs authentication data.
So inside my script, I tried to access my yahoo mail box which apparently needs username and password, I thought I would get 401, but I didn't.
Code:
yahoo_mail = 'http://mail.cn.yahoo.com'
br = mechanize.Browser()
r = br.open(yahoo_mail)
print r.info() #here, I got 200, it's ok apparently
br.select_form(nr=0) #select the login form
r = br.submit() #submit the form without providing username and password
print r.info() #but I didn't get 401, why?
Question:
- Why I didn't get 401 without providing auth-info ?
- If not my mail box, any other website can give me a 401 ?