I need to be able to block the urls that are stored in a text file on the hard disk using Python. If the url the user tries to visit is in the file, it redirects them to another page instead. How is this done?
Doing this at the machine level is a weak solution, it would be pretty easy for a technically inclined user to bypass.
Even with a server side proxy it will be very easy to bypass unless you firewall normal http traffic, at a bare minimum block ports 80, 443.
You could program a proxy in python as Alex suggested, but this is a pretty common problem and there are plenty of off the shelf solutions.
That being said, I think that restricting web access will do nothing but aggravate your users.
Internet Explorer URL blocking with Python?