Can python mechanize handle HTTP auth?

Posted by Shekhar on Stack Overflow See other posts from Stack Overflow or by Shekhar
Published on 2009-07-08T11:03:27Z Indexed on 2010/04/17 16:43 UTC
Read the original article Hit count: 421

Filed under:
|

Mechanize (Python) is failing with 401 for me to open http digest URLs. I googled and tried debugging but no success.

My code looks like this.

import mechanize

project = "test"
baseurl = "http://trac.somewhere.net"
loginurl = "%s/%s/login" % (baseurl, project)
b = mechanize.Browser()
b.add_password(baseurl, "user", "secret", "some Realm")
b.open(loginurl)

© Stack Overflow or respective owner

Related posts about python

Related posts about mechanize