How to get a “reactor” when running a twisted application using twistd?

My application uses "twisted.web.client.Agent" to get web content. But for an agent class, an instance of a “reactor” needs to be initiated. If I start my application with "twistd", there will be no "reactor.run ()" at all. So how can I get an instance of a "reactor"?

+5
source share
1 answer

I would like a better answer , but a way to get the current active reactor in a Twisted app:

from twisted.internet import reactor

, - "" , (, connectTCP -). Agent reactor .

+10

All Articles