re: help with pycurl/win32 and HTTP PUT

From: Kjetil Jacobsen <>
Date: Wed, 9 Feb 2005 13:10:22 +0100 (CET)


there is some information wrt callbacks and pycurl at

in particular, READDATA cannot be used when READFUNCTION is specified.
fortunately, this limitation can be overcome by using a class to store the
file reference (instead of using READDATA) and then set a class method as
the callback function like this:

class filereader:

    def __init__(self, f):
        self.f = f

    def read_callback(self, size):

import pycurl
c = pycurl.Curl()
f = filereader(open('somefile'))
c.setopt(c.URL, 'http://somehere/')
c.setopt(c.READFUNCTION, f.read_callback)



        - kjetil

Received on 2005-02-09