python - Pipe Twisted Request Content to STDIN of Process -
i'm looking pipe content of http post or put stdin of process. i'm using klein library , have following code: from klein import run, route twisted.internet import reactor, defer, protocol import os class curlprocprotocol(protocol.processprotocol): def __init__(self, data): self.data = data def connectionmade(self): self.transport.write(self.data) self.transport.closestdin() def outreceived(self, data): return 'got ' + str(data) @route('/') def home(request): d = defer.deferred() reactor.spawnprocess(curlprocprotocol(request.channel), '/usr/bin/curl', args=['curl', '-t', '-', 'ftp://localhost/test.txt'], env={'home': os.environ['home']}, usepty=false) d.addcallback(reactor.run) return d run("localhost", 8080) the problem ...