Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: problem with urllib

Reply
Thread Tools

Re: problem with urllib

 
 
Terry Reedy
Guest
Posts: n/a
 
      04-01-2009
venkat sanaka wrote:
> This was the code i executed.
>
> >>> proxies={'http':'10.1.2.21:9090 <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
> <http://10.1.2.21:9090>'


If you do not understand the error message and the error is in Python
code, you can go look at the code in the file to get a better idea. In
this case, the 'raise' statement is almost certainly preceded by an if
statement. See what condition was checked that your input would fail.
If necessary, you can edit request.py to add print statements (what I
would do, after copying to request.bak) what args are actually passed to
open_unknown_proxy. Or try pdb (which I never have).

>
> I know that url has to be used in proxies list but my proxy address is
> 10.1.2.21:9090 <http://10.1.2.21:9090> and it is squid proxy server.
>
> Regards
> venkat
>
> On Wed, Apr 1, 2009 at 4:35 AM, Chris Rebert <(E-Mail Removed)
> <(E-Mail Removed)>> wrote:
>
> 2009/3/31 venkat sanaka <(E-Mail Removed)
> <(E-Mail Removed)>>:
> > 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 <http://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.
>
> Cheers,
> Chris
> --
> I have a blog:
> http://blog.rebertia.com
>
>
>
> ------------------------------------------------------------------------
>
> --
> http://mail.python.org/mailman/listinfo/python-list


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
2to3 urllib.URLopener -> urllib.request.URLopener Chris McDonald Python 0 11-01-2010 11:23 AM
Asynchronous urllib (urllib+asyncore)? Jonathan Gardner Python 1 02-27-2008 12:51 AM
Problem with urllib.urlretrieve ralobao Python 1 06-12-2004 04:49 AM
urllib problem C GIllespie Python 0 01-15-2004 11:06 AM
httplib\urllib attributes problem Bobbie Python 2 07-21-2003 07:45 AM



Advertisments