Prueba de usar el PoxyBasicAuthHandler a ver. Aunque igual usa ProxyDigestAuthHandler (por eso lo que te decía Moises de que clase de autenticación requiere).
http://nullege.com/codes/search/urllib2.ProxyBasicAuthHandler http://nullege.com/codes/search/urllib2.ProxyDigestAuthHandler A ver si te sirve, Saludos, Raúl 2011/3/1 (P@vel) <pdlo...@uci.cu> > Asi lo tengo > uri = "http://www.google.com" > http_proxy_server = "100.0.0.1" > http_proxy_port = "3128" > http_proxy_realm = http_proxy_server # Worked in my (limited) testing > environment. > http_proxy_user = "pepito" > http_proxy_passwd = "pepito" > > > Te esta devolviendo un 403 Forbidden. No tienes permisos. Estás seguro que > el usuario y el password que has puesto son correctos. Debes poner tus > valores de user/password en los campos: > > http_proxy_user = "username" > http_proxy_passwd = "password" > > Saludos, > > Raúl > > > > On Tue, Mar 1, 2011 at 10:25 PM, (P@vel) <pdlo...@uci.cu> wrote: > >> El codigo de la pagina me da el siguiente error >> >> Traceback (most recent call last): >> File "prueba4.py", line 34, in <module> >> open_url_installed_opener() >> File "prueba4.py", line 26, in open_url_installed_opener >> urllib2.urlopen(uri) >> File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen >> return _opener.open(url, data, timeout) >> File "/usr/lib/python2.6/urllib2.py", line 397, in open >> response = meth(req, response) >> File "/usr/lib/python2.6/urllib2.py", line 510, in http_response >> 'http', request, response, code, msg, hdrs) >> File "/usr/lib/python2.6/urllib2.py", line 435, in error >> return self._call_chain(*args) >> File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain >> result = func(*args) >> File "/usr/lib/python2.6/urllib2.py", line 518, in http_error_default >> raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) >> urllib2.HTTPError: HTTP Error 403: Forbidden >> >> >> >> On 1 March 2011 14:08, (P@vel) <pdlo...@uci.cu> wrote: >> > Este codigo me funciona para una pagina local, o que no requiera proxy. >> > >> > import urllib >> > f = urllib.urlopen("http://intranet.hlg.uci.cu") >> > data = f.read() >> > f.close() >> > print data >> > >> > >> > Pero como yo me conecto a internet mediante un proxy trate con esto >> > >> > import urllib >> > proxies = {'http': 'http://100.0.0.1:3128'} >> > f = urllib.urlopen("http://www.google.com",proxies=proxies) >> > data = f.read() >> > f.close() >> > print data >> > >> > y me da el siguiente error >> > raceback (most recent call last): >> > File "/home/pavel/workspace/spider/src/prueba3.py", line 6, in >> <module> >> > f = urllib.urlopen("http://www.google.com",proxies=proxies) >> > File "/usr/lib/python2.6/urllib.py", line 86, in urlopen >> > return opener.open(url) >> > File "/usr/lib/python2.6/urllib.py", line 205, in open >> > return getattr(self, name)(url) >> > File "/usr/lib/python2.6/urllib.py", line 360, in open_http >> > return self.http_error(url, fp, errcode, errmsg, headers) >> > File "/usr/lib/python2.6/urllib.py", line 373, in http_error >> > result = method(url, fp, errcode, errmsg, headers) >> > File "/usr/lib/python2.6/urllib.py", line 703, in http_error_407 >> > errcode, errmsg, headers) >> > File "/usr/lib/python2.6/urllib.py", line 383, in http_error_default >> > raise IOError, ('http error', errcode, errmsg, headers) >> > IOError: ('http error', 407, 'Proxy Authentication Required', >> > <httplib.HTTPMessage instance at 0x93f4e6c>) >> > >> >> usa urllib2 con el cual puedes agregar autenticacion: >> >> >> http://www.wkoorts.com/wkblog/2008/10/27/python-proxy-client-connections-requiring-authentication-using-urllib2-proxyhandler/ >> >> >> >> -- >> http://blog.mbrenes.com >> Debian debian.org - The Universal Operating System. >> >> El individuo ha luchado siempre para no ser absorbido por la tribu. >> Si lo intentas, a menudo estarás solo, y a veces asustado. >> Pero ningún precio es demasiado alto por el privilegio de ser uno mismo >> >> - Friedrich Nietzsche. >> _______________________________________________ >> Python-es mailing list >> Python-es@python.org >> http://mail.python.org/mailman/listinfo/python-es >> FAQ: http://python-es-faq.wikidot.com/ >> >> _______________________________________________ >> Python-es mailing list >> Python-es@python.org >> http://mail.python.org/mailman/listinfo/python-es >> FAQ: http://python-es-faq.wikidot.com/ >> >> > > > -- > Raúl Cumplido > > _______________________________________________ Python-es mailing list > Python-es@python.org http://mail.python.org/mailman/listinfo/python-esFAQ: > http://python-es-faq.wikidot.com/ > > _______________________________________________ > Python-es mailing list > Python-es@python.org > http://mail.python.org/mailman/listinfo/python-es > FAQ: http://python-es-faq.wikidot.com/ > > -- Raúl Cumplido
_______________________________________________ Python-es mailing list Python-es@python.org http://mail.python.org/mailman/listinfo/python-es FAQ: http://python-es-faq.wikidot.com/