problem with urllib

venkat sanaka venkatsanaka at gmail.com
Wed Apr 1 01:21:09 CEST 2009


Yeah I did i was getting the same error as i got without using http in the
url.

Regards venkat.

On Wed, Apr 1, 2009 at 4:46 AM, Chris Rebert <clp2 at rebertia.com> wrote:

> > On Wed, Apr 1, 2009 at 4:35 AM, Chris Rebert <clp2 at rebertia.com> wrote:
> >>
> >> 2009/3/31 venkat sanaka <venkatsanaka at gmail.com>:
> >> > hii everyone
> >> >
> >> > I am new to python programming.And i started implementing a http
> client
> >> > using urllib in which
> >> > i was facing a problem with proxy support.i was behind a proxy server
> >> > and
> >> > need to use
> >> > proxy of format 10.1.2.21:8080 to connect to internet.when i used
> this
> >> > with
> >> > proxyhandler
> >> > of urllib i got errors showing invalid proxy.can someone help me out
> >> > plzzz.
> >>
> >> What errors exactly? People will need the error message and full
> >> traceback in order to help you.
> >> A copy of your code would also be necessary for anyone trying to help
> you.
>
> On Tue, Mar 31, 2009 at 4:10 PM, venkat sanaka <venkatsanaka at gmail.com>
> wrote:
> > This was the code i executed.
> >
> >>>> proxies={'http':'10.1.2.21:9090'}
> >>>> opener = urllib.request.FancyURLopener(proxies)
> >>>> f = opener.open("http://www.python.org")
> >
> > Exception AttributeError: AttributeError("'FancyURLopener' object has no
> > attribute 'tempcache'",) in <bound method FancyURLopener.__del__ of
> > <urllib.request.FancyURLopener object at 0x010A40F0>> ignored
> > Traceback (most recent call last):
> >   File "<pyshell#11>", line 1, in <module>
> >     f = opener.open("http://www.python.org")
> >   File "C:\Python30\lib\urllib\request.py", line 1439, in open
> >     return self.open_unknown_proxy(proxy, fullurl, data)
> >   File "C:\Python30\lib\urllib\request.py", line 1458, in
> open_unknown_proxy
> >     raise IOError('url error', 'invalid proxy for %s' % type, proxy)
> > IOError: [Errno url error] invalid proxy for http: '10.1.2.21:9090'
> >
> > I know that url has to be used in proxies list but my proxy address is
> > 10.1.2.21:9090 and it is squid proxy server.
>
> Have you tried including the protocol in the proxy URL as per the
> module's examples? Like:
>
> proxy = {'http' : 'http://10.1.2.21:9090'}
> f = urllib.urlopen("http://python.org", proxies=proxy)
>
> Cheers,
> Chris
>
> --
> I have a blog:
> http://blog.rebertia.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090401/7ba15efc/attachment.html>


More information about the Python-list mailing list