[Twisted-web] rest webservice and big data.

Sébastien HEITZMANN 2le at 2le.net
Mon Aug 20 13:11:33 EDT 2007


Hi

I'm new to twisted programming and I'm wonder how to do the following thing.

I would like to save in a file the content of a PUT method. But i need
this in a stream mode ( the data may be handred of MB )

Here is a part of my code.

class DataResource(resource.Resource):
    def __init__(self, dbConnection):
        resource.Resource.__init__(self)

    def render_PUT(self, request):
        request.content.seek(0)
        file('data.dat','wb').write(request.content.read())
        request.write('OK')
        request.finish()


Thats inspired by an exemple of the oreilly book.

Is there a way to get a coolback juste after the header was sended and
to handle the reading of the remaining data myself ?

I use only web, not the new web2 api.

Thanks in advance for any help or link.

Sebastien.





More information about the Twisted-web mailing list