curl-and-python

Re: PyCurl READFUNCTION - set number of characters to read

From: Dima Tisnek <dimaqq_at_gmail.com>
Date: Tue, 22 Oct 2013 16:56:55 -0700

My guess is, pycurl allocates some buffer and thus you need to return exact
size from python world.

I gather it's easier to implement required buffering in python anyway.
On 22 Oct 2013 16:50, "Tom Rioux" <trioux_at_tango.me> wrote:

> The format of the pycurl readback function is this:
> READFUNCTION(*number of characters to read*)*-> string*
>
> My function starts off like this:
>
> def my_pycurl_READFUNCTION(pycurl_size):
> print('pycurl_size=%s' % pycurl_size)
> ...
> return some_value # where some_value > 16kb
>
> The value of pycurl_size is 16384 (16kb).
>
> I get this error when the return string is larger than 16kb:
>
> pycurl.error: invalid return value for read callback 16925 16384
>
>
> Is it possible to change the value that is passed to the READFUNCTION
> callback?
>
> I tried setting BUFFERSIZE, but it appears to be a WRITEFUNCTION option.
>
> Thanks,
> Tom
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2013-10-23