[Tutor] urllib confusion

Clayton Kirkwood crk at godblessthe.us
Sat Nov 22 00:57:00 CET 2014



>-----Original Message-----
>From: Joel Goldstick [mailto:joel.goldstick at gmail.com]
>Sent: Friday, November 21, 2014 2:39 PM
>To: Clayton Kirkwood
>Cc: tutor at python.org
>Subject: Re: [Tutor] urllib confusion
>
>On Fri, Nov 21, 2014 at 4:37 PM, Clayton Kirkwood <crk at godblessthe.us>
>wrote:
>> Hi all.
>>
>>
>>
>> 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.

>
>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.

>
>Also, please use plaintext for your questions.  That way everyone can
>read them, and the indentation won't get mangled
>>
>> I’ve read through a lot that says that urllib..urlopen needs
>> urlencode, and/or encode(‘utf-8’) for byte conversion, but I’ve seen
>> plenty of examples where nothing is being encoded either way. I also
>> have a sneeking suspicious that urllib2 code does all of the encoding.
>> I’ve read that if things aren’t encoded that I will get TypeError, yet
>> I’ve seen plenty of examples where there is no error and no encoding.
>>
>>
>>
>> Why do so many examples seem to not encode? And not get TypeError? And
>> yes, for those of you who are about to suggest it, I have tried a lot
>> of things and read for many hours.
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Clayton
>>
>>
>>
>>
>>
>>
>>
>> You can tell the caliber of a man by his gun--c. kirkwood
>>
>>
>>
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> https://mail.python.org/mailman/listinfo/tutor
>>
>
>
>
>--
>Joel Goldstick
>http://joelgoldstick.com





More information about the Tutor mailing list