[Web-SIG] urllib package addressing PEP 3108

Facundo Batista facundobatista at gmail.com
Wed Jun 18 19:52:55 CEST 2008


2008/6/16 O.R.Senthil Kumaran <orsenthil at gmail.com>:

> (urllib2.py and url handling functions from urllib (URLOpener, FancyURLOpener)
> and then parse.py ( urlparse.py and parsing related methods from urllib).
> http://bugs.python.org/issue2885 tracks the package creation.

I think Jeremy will handle this today...

O.R., did you make some of this work? Can you help Jeremy somehow?


> 1) urlopen method. Both urllib.py and urllib2.py currently have this method,
> urllib one takes proxies as the last argument and urllib2 takes timeout as the
> last argument.
> How do we have both of them?
>
> My thought, have urllib2's urlopen, because it anyway provides the proxy
> handling through handlers and discard urllib's urlopen method.
>
> Comments please?

Which would be the drawback of accepting the proxies directly in the
urlopen() function?

Right now, to use a proxy I do:

proxy = urllib2.ProxyHandler({"http":"http://www.norealproxy.com:8080"})
opener = urllib2.build_opener(proxy, urllib2.HTTPHandler)
urllib2.install_opener(opener)
def ericsson_urlopen(*args):
    return urllib2.urlopen(*args)

Maybe I could use the syntax of urllib.urlopen(), and that it
automatically to do that?


> Now, splitting the methods to request.py and parse.py
>
> request.py - urlopen (urllib2's), URLopener, FancyURLopener, urlretrieve,
>             urlcleanup, localhost, thishost, ftperrors, getproxies.
>
> parse.py -   quote, quote_plus, unquote, unquote_plus, urlencode, url2pathname,
>             pathname2url, splittag,basejoin,unwrap,splittype,splithost,
>             splituser, splitpasswd, splitport,splitnport,splitquery,splitattr,              splitvalue

+1

Regards,

-- 
. Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/


More information about the Web-SIG mailing list