cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PyCURL] READFUNCTION not getting called?

From: Ryan Wilcox <ryanwilcox_at_mac.com>
Date: Fri, 18 Jun 2004 12:30:12 -0400

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi guys, I'm new to PyCurl (and libcurl use in general), and I have a
question....

It appears my READFUNCTION is not getting called in the following script (and I.

{python}

#! /opt/local/bin/python

import pycurl

class Test:
    def __init__(self):
        self.contents = ''
    
    def read_callback(self, something, charsToRead):
        #I also tried just one parameter here
        print something
        print charsToRead
        print "read called"
        return ''
        
    def body_callback(self, buf):
        print "write called"
        self.contents = self.contents + buf

t = Test()

c = pycurl.Curl()

c.setopt(c.URL, "http://127.0.0.1/cgi-bin/cgiwrap/aias/HTTPTest.cgi")

c.setopt( c.READFUNCTION, t.read_callback )
c.setopt( c.POSTFIELDSIZE, 22 )

c.setopt( c.WRITEFUNCTION, t.body_callback )
c.perform()
c.close()

print t.contents

{/python}

I expect to have a "read called" printed for me, but it is not.

Anybody have any ideas?

Thank you,
_Ryan Wilcox

================================================================
Wilcox Development Solutions: http://www.wilcoxd.com
Toolsmiths for the Internet Age PGP: 0x2F4E9C31

-----BEGIN PGP SIGNATURE-----
Version: PGP SDK 3.0.3

iQA/AwUBQNMYkW2DtKgvTpwxEQLg9gCfcNJmW1kNIADKnKTLwVeXL2voGTYAoIpH
eCZpDcyebiRRGqLw3aitr5+W
=DbuK
-----END PGP SIGNATURE-----
Received on 2004-06-18