[Twisted-Python] observer patter in twisted?
![](https://secure.gravatar.com/avatar/29a0aa8a2d21daab540e6ea485ed7c4f.jpg?s=120&d=mm&r=g)
hi, I want implement such situation: a client detected a message change, then it notify all the servers that registed this message arrived. Is observer patter already implemented in Twisted? BTW, in Twisted, Is a serverFactory instance one thread? thanks.
![](https://secure.gravatar.com/avatar/d37c7104c024b78dc451e3a6b733df9d.jpg?s=120&d=mm&r=g)
I've got a job-queue process implemented twisted that interfaces with Postgres and occasionally downloads some urls To handle the URLs, I'm using mechanize. I know that twisted.web1 has the client, but it seems to be not actively maintained, and there's no client in twisted.web2. mechanize is actively maintained and has a bunch of features that I like, so its a win win situation. except for timeouts mechanize doesn't have a timeout of its own. its using a global timeout , i think its using the default python socket timeout, and there isn't any override available. a 60s timeout doesn't work for me. i need 10s-- but i can't change the global timeout , as its in a long running process and I don't want to interfere with any of my other tasks. so I'm thinking that I somehow wrap mechanize and toss it into the event loop. rather than spend a few hours reinventing the wheel, i figure someone here *might* have done this before and can offer a pointer. anyone?
![](https://secure.gravatar.com/avatar/ed863cc7855c13a3c8308b066ff09311.jpg?s=120&d=mm&r=g)
On Tue, 12 Sep 2006 21:10:26 -0400, Jonathan <twisted-python@2xlp.com> wrote:
I'm not sure that there is much active maintenance to do. For what it's worth, I've called t.web.client.getPage() at least 10 million times, and i don't have any complaints. -- Moe Aboulkheir
![](https://secure.gravatar.com/avatar/f9a435166977fabd5d9fdf4bba5d5459.jpg?s=120&d=mm&r=g)
On Tue, 12 Sep 2006 21:48:02 -0500, Moe Aboulkheir <moe@divmod.com> wrote:
My experience has been the same; I've used twisted.web.client for years now, in production applications, with no issues. That said, the original poster didn't mention any special requirements that forced him to go with mechanize; rather, the choice appears to have been made on the basis of activity. That said, there *is* a web2-based client, available from OSAF, named zanshin. I haven't used it, but it is most certainly being actively developed. L. Daniel Burr
![](https://secure.gravatar.com/avatar/d37c7104c024b78dc451e3a6b733df9d.jpg?s=120&d=mm&r=g)
I've got a job-queue process implemented twisted that interfaces with Postgres and occasionally downloads some urls To handle the URLs, I'm using mechanize. I know that twisted.web1 has the client, but it seems to be not actively maintained, and there's no client in twisted.web2. mechanize is actively maintained and has a bunch of features that I like, so its a win win situation. except for timeouts mechanize doesn't have a timeout of its own. its using a global timeout , i think its using the default python socket timeout, and there isn't any override available. a 60s timeout doesn't work for me. i need 10s-- but i can't change the global timeout , as its in a long running process and I don't want to interfere with any of my other tasks. so I'm thinking that I somehow wrap mechanize and toss it into the event loop. rather than spend a few hours reinventing the wheel, i figure someone here *might* have done this before and can offer a pointer. anyone?
![](https://secure.gravatar.com/avatar/ed863cc7855c13a3c8308b066ff09311.jpg?s=120&d=mm&r=g)
On Tue, 12 Sep 2006 21:10:26 -0400, Jonathan <twisted-python@2xlp.com> wrote:
I'm not sure that there is much active maintenance to do. For what it's worth, I've called t.web.client.getPage() at least 10 million times, and i don't have any complaints. -- Moe Aboulkheir
![](https://secure.gravatar.com/avatar/f9a435166977fabd5d9fdf4bba5d5459.jpg?s=120&d=mm&r=g)
On Tue, 12 Sep 2006 21:48:02 -0500, Moe Aboulkheir <moe@divmod.com> wrote:
My experience has been the same; I've used twisted.web.client for years now, in production applications, with no issues. That said, the original poster didn't mention any special requirements that forced him to go with mechanize; rather, the choice appears to have been made on the basis of activity. That said, there *is* a web2-based client, available from OSAF, named zanshin. I haven't used it, but it is most certainly being actively developed. L. Daniel Burr
participants (4)
-
Jonathan
-
L. Daniel Burr
-
Moe Aboulkheir
-
wang wei