i want to use circuits to implement a client which passes messages via TCP to a server and reacts to incoming messages.The client has to fetch an authentication token from a (different) HTTP server.I'm using python 3.3 and circuits 3.0.0.devAfter reading the tutorial and experimenting a little with the examples, I'm currently stuck with the following code:import loggingfrom circuits import Debuggerfrom circuits.web.client import Client, requestlogging.basicConfig(level='DEBUG')logger = logging.getLogger(__name__)class DemoHttpClient(Client):def __init__(self):super(DemoHttpClient, self).__init__()def started(self, *args):logger.debug('Started!')self.fire(request('GET', 'http://www.google.com'))logger.debug(self.response())if __name__ == '__main__':logger.debug('GO!')(DemoHttpClient() + Debugger()).run()I'm trying to fire a request event and receive the response event.
There are several questions - (I'm absolutely new to event driven programming, so please bear with me):
- The started handler is never called and I don't understand why. Could some kind soul point out my error for me?
- What is the intended way to react to the response - instinctively I'd say override the handler in the base class and call the super implementation first, but the Client class has a "private" handler for the response - so I suppose that would be the wrong approach @handler("response") def _on_response(self, response): ...
--
You received this message because you are subscribed to the Google Groups "circuits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to circuits-user...@googlegroups.com.
To post to this group, send email to circuit...@googlegroups.com.
Visit this group at http://groups.google.com/group/circuits-users.
For more options, visit https://groups.google.com/d/optout.
I think I know why... I'll try to respond in more detail as soon as I can! (My Desktop SSD died recently so I'm a little useless right now!)