HTTP Authentication using urllib2

Wojtek Walczak gminick at bzt.bzt
Fri Apr 24 23:45:10 CEST 2009

On Fri, 24 Apr 2009 04:25:20 -0700 (PDT), Lakshman wrote:
> I am trying to authenticate using urllib2. The basic authentication
> works if I hard code authheaders.
>     except IOError, e:
>         print "Something wrong. This shouldnt happen"

First of all, don't shoot yourself in the foot and check what
the exceptions are, i.e.:

         import traceback
         print traceback.format_exc()

Second, better use mechanize:

Wojtek Walczak,

More information about the Python-list mailing list