Don't bother with password managers. For HTTP basic authentication, the quickest way is to add the auth header yourself. Here is the code.
>>> import urllib2, base64 >>> r = urllib2.Request('http://www.tek-tips.com') >>> auth=base64.encodestring('%s:%s' % ('johnny','yesyes') ... ) >>> auth 'am9obm55Onllc3llcw==\n' >>> r.add_header('Authorization','Basic %s' % auth) >>> urllib2.urlopen(r) <addinfourl at 2145898156 whose fp = <socket._fileobject object at 0x7ff35304>> --Anand On Thu, Jul 24, 2008 at 5:05 PM, Vijay Ramachandran <[EMAIL PROTECTED]> wrote: > On 7/24/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: >> >> From: Pythonic <[EMAIL PROTECTED]> >> Subject: Re: [BangPypers] automate logging >> To: [EMAIL PROTECTED], Bangalore Python Users Group - India >> leo davis wrote: >> > >> > Hello, >> > I'm trying to write a code to automate logging into a website.I have >> > chosen the forum 'www.tek-tips.com' as an example and tried this >> > script on it....But it doesnt seem to work...What am i missing >> > here..plz help >> > >> > theurl = 'www.tek-tips.com' >> > protocol = 'http://' >> > username = 'johnny' >> > password = 'yesyes' >> > >> > passman.add_password(None, theurl, username, password) > > change "theurl" to contain the protocol as well, i.e., instead of the above, > try > passman.add_password(None, protocol + thurl, username, password) > > If it works - don't ask me why! I ran into the same problem, and discovered > this through trial and error. > > Vijay > > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > > -- -Anand _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers