[Twisted-Python] Web Proxy that does something different once a day

Matt Hubbard m.hubbard at imperial.ac.uk
Thu Sep 20 09:08:54 EDT 2007

Fred Trotter wrote:
> Hello,
>          I am new to python and I am potentially interested in writing
> a new protocol with Twisted.  However I wanted to start with a simpler
> problem that I have been working on, so that I can understand better
> how twisted works.
>         A particular client wants to enforce a home page for the first
> internet connection each day. They have a intranet portal that gives
> messages to employees and they want to be sure that each employee, no
> matter how they have their homepage set, will see the messages the
> first time they connect. After the first connection they want the
> proxy to simply forward requests to the internet without filtering.
>         Since I need to understand this issue for my other project
> too, how do I get the python loop do one thing based on a "new day"
> for an IP address and then do something else after that action has
> been completed. Example code that addresses my problem would be great,
> but I would be happy to have links to examples that do this...


To effectively achieve what you've outlined is really quite involved, and the answer to your question is heavily tied to the implementation.

You will be controlling access by clients to the internet. You will make that decision based essentially three factors:
- Client IP Address making access request.
- When the client IP address last accessed what version of the Required Reading.
- What is the current version of the Required Reading / when did it renew.

In order to provide some example code, the frame work of the implementation needs to be known.


More information about the Twisted-Python mailing list