469,602 Members | 1,795 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Re: Problem with urllib2 and authentification

"Miguel Beltran R." <yo*******@gmail.comwrites:
Using this script for connect to Zope I have this error
You forgot to add the authentication handler to the list of handlers.
See below.
>
---script:
import urllib2

protocolo='http://'
servidor='10.28.1.239/'
pagina='manage'
fullurl=protocolo+servidor+pagina

aut=urllib2.HTTPBasicAuthHandler()
aut.add_password(realm=None,
uri=servidor,
user='myadmin',
passwd='mypass')
opener=urllib2.build_opener(aut, urllib2.HTTPHandler(debuglevel=1))
Add here:

opener.add_handler(aut))

print opener.open(fullurl).read()
HTH,
Rob
Jun 27 '08 #1
1 927
Rob Wolfe <rw@smsnet.plwrites:
>---script:
import urllib2

protocolo='http://'
servidor='10.28.1.239/'
pagina='manage'
fullurl=protocolo+servidor+pagina

aut=urllib2.HTTPBasicAuthHandler()
aut.add_password(realm=None,
uri=servidor,
user='myadmin',
passwd='mypass')
opener=urllib2.build_opener(aut, urllib2.HTTPHandler(debuglevel=1))
Please ignore me. I overlooked that you added this handler here.
But anyway I would try this `add_handler` method. ;)

Rob
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by O. Koch | last post: by
4 posts views Thread by bmiras | last post: by
5 posts views Thread by Pascal | last post: by
reply views Thread by Pieter Edelman | last post: by
1 post views Thread by Ray Slakinski | last post: by
reply views Thread by Ali.Sabil | last post: by
reply views Thread by dba123 | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.