[Twisted-web] Mingling client and server code

Dominic Fox dominic.fox at gmail.com
Thu Jul 1 09:43:06 MDT 2004

I have a server application that needs to send and receive email,
whilst serving web pages. Although it's fairly straightforward just to
use poplib and smtplib and perform mailing operations in a background
thread, I'd rather make use of the mail libraries in Twisted and
perform these tasks asynchronously. My question is, assuming an
application that's set up like this:

site = server.Site(root)
application = service.Application('web')
sc = service.IServiceCollection(application)
i = internet.TCPServer(8001, site)
t = internet.TimerService(10, checkInbox)

how do I write the Twisted client code inside checkInbox()? Presumably
it needs to create a client object, get the application's reactor to
attempt a connection, and get the object to handle callbacks from
reactor. But how do we get a reference to the application's reactor to
begin with?


More information about the Twisted-web mailing list