Re: Urllib2 / add_password method



"mrstephengross" <mrstephengross@xxxxxxxxxxx> writes:

I'm working on learning how to use urllib2 to use a proxy server. I've
looked through the postings on this group, and it's been helpful. I
have not, however, found complete documentation on the add_password()
functions. Here's what I've got so far:

Don't use a password manager with proxy auth in 2.4, it doesn't work:

http://python.org/sf/1470846

[...]
It works, but I don't really know what I'm doing with the
proxy_auth_handler part. Specifying username and password make sense,
but I haven't found documentation on what 'realm' and 'host' are for.
Shouldn't username & password be sufficient?

Both proxy and auth handling in urllib2 are buggy in 2.4, but passing
the username and password in the "userinfo" component of the URL works
(didn't read your code, hope nothing important in there):

import urllib2

proxy_handler = urllib2.ProxyHandler({
"http": "http://john:password@xxxxxxxxxxxxxxxxx:3128"})
opener = urllib2.build_opener(proxy_handler)

response = opener.open(url)


However, ISTR specifying a port number as I do above (the ":3128" bit)
is not supported in 2.4 (it does in current SVN, so will in 2.5).


Hmm, I notice just now that urllib2's digest auth support breaks
urllib2's handler scheme. Must file another bug...


John

.



Relevant Pages

  • The use of the auth-group (and auth-user) ?
    ... documentation. ... change passwd, lock accounts; and ... What do they (auth user/group) own? ... So a general question about SCO... ...
    (comp.unix.sco.misc)
  • Re: Sending Emal2SMS
    ... you want to know what type of AUTH is supported. ... After you receive the response to the EHLO command you will need to ... EHLO response will tell you what the smtp server accepts. ... To get the long string that contains your username and password you can ...
    (microsoft.public.fox.programmer.exchange)
  • Help - Authentication with ASP
    ... authentication window in which put username and password). ... IF auth = "" THEN ... Set objConn = Nothing ... checkLogin, us, pwd ...
    (microsoft.public.inetserver.asp.general)
  • Re: Win2003 IAS CRPs attribute manipulations == MS-CHAPv2 login failures.
    ... The computation of the Peer-Challenge uses the username as one of its ... This would explain why the MYDOMAIN\ find/replace set works, ... AUTH cannot validate the peer ... On PROXY create a remote server group that points to AUTH ...
    (microsoft.public.internet.radius)
  • Re: [opensuse] nfs server /require/ reverse DNS lookup working?!
    ... documentation that this can happen. ... * requires reverse DNS. ... Some times, the Windows client ask for a username and password, because ...
    (SuSE)