[Tutor] urllib confusion

Cameron Simpson cs at zip.com.au
Mon Nov 24 03:34:44 CET 2014


On 21Nov2014 15:57, Clayton Kirkwood <crk at godblessthe.us> wrote:
>>> Got a general problem with url work. I’ve struggled through a lot of
>>> code which uses urllib.[parse,request]* and urllib2. First q: I read
>>> someplace in urllib documentation which makes it sound like either
>>> urllib or urllib2 modules are being deprecated in 3.5. Don’t know if
>>it’s only part or whole.
>>
>>The names of the modules changed I believe in v3.x.
>
>I don't think so because I've seen both lib and lib2 in both new and old code, and current 4.3 documentation talks only of urllib.

You mean "3.4" I would hope.

It is clear from this:

  https://docs.python.org/3/py-modindex.html#cap-u

that there is no "urllib2" in Python 3, just "urllib".

I recommend you read this:

  https://docs.python.org/3/whatsnew/3.0.html

which is a very useful overview of the main changes which came with Python 3, 
and covers almost all the "structural" changes (such as module renames); the 
3.0 release was the Big Change.

>>But you can save yourself a lot of trouble by using the excelent 3rd
>>party package called requests:
>>http://docs.python-requests.org/en/latest/
>
>I've seen nothing of this.

You have now. It is very popular and widely liked.

Cheers,
Cameron Simpson <cs at zip.com.au>

'Supposing a tree fell down, Pooh, when we were underneath it?'
'Supposing it didn't,' said Pooh after careful thought.


More information about the Tutor mailing list