[Yum] Basic auth fails in 1.97, works in previous versions

Joe Cooper joe at swelltech.com
Fri May 16 10:49:50 UTC 2003

seth vidal wrote:
> On Thu, 2003-05-15 at 20:15, Joe Cooper wrote:
>>Hi Seth and all,
>>I'm not sure if this is a bug of the Python urllib, or a new 'feature' 
>>of yum 1.97, but authentication information in the URL is no longer 
>>accepted by yum.

> gist:
>  urllib2 broke out the http auth information into some more named args.
>  urllib is what was used in 1.0 - and it didn't do that
> ftp url's with user/pass will still work in 1.97
> won't work under urllib2
> I have plans to hack urlgrabber to add auth support that is consistent
> for http and ftp.
> so each repo would then have
> user=username
> password=password 
> in the repository stanza.
> but I haven't had time b/c I've been busy with everything else :)
> Joe, 
>  please file an rfe/bugreport in bugzilla for this one so I'll remember.

Hi Seth,

Thanks for your quick reply.  I'm going to tackle it myself, since I 
have to have it in order to roll out Red Hat 9 to clients.

I think I have most of it covered.  I've added two arguments to 
retrygrab/urlgrab for user and password.  I've created the 
HTTPBasicAuthHandler(), and made an optional opener.add_handler along 
the lines of the Keepalive stuff that is already in there.

Anyway, I think I have all of the back-end bits.  But now I'm looking at 
the way arguments are passed around (and more importantly, how 
infrequently the serveridlist is being passed around), and I don't see 
how to get the user and password into the places where I need it (i.e. 
everywhere a retrygrab and urlgrab happen).  It looks like I'm going to 
have to re-write large chunks of code to haul extra stuff around, when 
it seems like it ought to be very simple.

Am I looking at this the wrong way?  Is there something magic I can do 
to make the user and password just get to where they're going without 
passing them around so much?  Do I even have to have login and pass as 
arguments to urlgrab?  As I mentioned, me and python are new 
acquaintences and I'm a clumsy coder even in languages that are more 
familiar, so I'm learning as I go and this one is a bit of a stumper.

Thanks for any tips anyone can provide.
Joe Cooper <joe at swelltech.com>
Web caching appliances and support.

More information about the Yum mailing list