[Twisted-Python] session

William Dode wilk-ml at flibuste.net
Sun Feb 16 02:56:41 EST 2003

"Thomas Weholt" <2002 at weholt.org> writes:

> This is very interesting. I found out much of what was unclear when I posted
> my earlier posting to this list by looking at this code. But I have some
> more questions :

if twisted guru could confirm that it's the right way ? i could make a
little documentation cgi<->twisted

> - how do I send HTTP-headers to the client?

request.setHeader(self, k, v)
Set an outgoing HTTP header. (inherited from Request)

for example setHeader("content-type","text/csv")

> - if I want to create some webservices, both XML-RPC and SOAP-based without
> starting a different server using something like the code below, how do I do
> that? I want to run one server, providing both webservices and content aimed
> at browsers.
> - is this the preferred way of doing things? Can I base my work on this
> example? Drawbacks? I need the fastest, most scalable method available,
> which can handle lots of concurrent users, several downloads and processes
> at the same time, both using simple web-pages, webservices like the ones
> mentioned earlier and ftp-access for administrators to maintain files served
> by the server, both static files and source-code. The server should be able
> to reload, using updated source without a complete restart. That would be
> the ultimate platform. I'm still a bit unclear on wheter Twisted is a async.
> *blocking* framework, making concurrent downloads harder, if at all
> possible, or if it is similar to the threaded solution available in the
> standard python distr. I've based my solutions on a threaded version of
> BaseHTTPServer so far, and been told this is not very scalable. But I need a
> non-blocking solution, where one process doesn't lock the entire server
> until that process is over before other clients are handled.

The IO are not blocked, you can upload/download big files in the same
times without worry about this, even if the client are slow.
Thread are blocked, you have to "defer" when you will do long task.
In the archive of the mailing-list, there is a good example of using
defered with sql query.

William Dode - http://flibuste.net

More information about the Twisted-Python mailing list