[Tutor] Truncated urlopen

Joel Goldstick joel.goldstick at gmail.com
Mon Feb 11 16:12:12 CET 2013


On Mon, Feb 11, 2013 at 10:00 AM, Válas Péter <sulinet at postafiok.hu> wrote:

> 2013/2/11 Dave Angel <davea at davea.name>
>
>> I'd suggest splitting that expression into two separate statements, one
>> that does the read, and the other that decodes.  Then you can print the
>> byte-string, and see if it also is truncated, or whether that happened
>> during the decoding.
>>
>> Also, if you use print( repr(mystring) )
>> you might discover that there are funny escape sequence characters that
>> are fooling your console.
>>
>
> Thanks, Dave,
> none of these helps. They are truncated as well.
>
> But I noticed a strange phenomenon. I am supposed to login to this page,
> but I can reach CVS data without login if I use the direct link to export.
> This may be a bug, but I like it. :-) Now, If I use the same link in
> browser, I get different results depending on I have logged in or not. (But
> in the first times of gathering data in this table, my Python script worked
> well!)
>
> So I should try to log in, but I have always difficulties with logging in
> from Python. I know http://docs.python.org/3/howto/urllib2.html#id6, but
> I couldn't use it in practice.
> Another way would be to log in in the browser correctly, then export CVS
> and process it with Python after saving, but I am too lazy to repeat this
> all the time. :-)
>
>
> There is a library called 'requests'
http://docs.python-requests.org/en/latest/ that I have used to access
websites.  It seems much less confusing than urllib/urllib2 to me.

>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130211/cab1cc7e/attachment-0001.html>


More information about the Tutor mailing list