Hi, bare with me with this as it's my first python program. I've spent a few hours Googling and testing for a solution but I'm at that point where I think I just need a helping hand from one of you kind people.
My idea for this program is to have a simple (supposedly) script that monitors what time it is, and when it's in a certain time range (for example 6am to 7pm) it navigates to opendns.com and blocks certain websites using the web content filtering feature.
Now because I'm quite the novice when it comes to python I thought I'd start it simple and just figure out the commands to login to the website and block a website and worry about the monitoring of the time etc later on. But sadly I'm having trouble with that aswell.
I'm using http://twill.idyll.org/
but not sure if that's a good idea or not. It's the only one I could find apart from mechanize (Which I couldn't find the right documentation for, but perhaps I'm just not looking in the right places)
Here is my code (well, it's not really code yet. Just a list of commands for the Python Shell.):
from twill import get_browser
from twill.commands import *
username = "firstname.lastname@example.org" # email for opendns
password = "thisisthepassword" # password for opendns
b = get_browser()
fv("2", "username", username)
fv("2", "password", password)
") # I replaced my network ID due to privacy reasons but this is basically the URL to the web content filtering page on OpenDNS for a network
Now that's where my problem starts. On that last b.showforms() I get an error:
Traceback (most recent call last):
File "", line 1, in
File "C:Python27libsite-packages will-0.9-py2.7.egg willrowser.py", line 225, in showforms
forms = self.get_all_forms()
File "C:Python27libsite-packages will-0.9-py2.7.egg willrowser.py", line 259, in get_all_forms
global_form = self._browser.global_form()
File "C:Python27libsite-packages will-0.9-py2.7.egg willother_packages_mechanize_dist_mechanize.py", line 446, in global_form
File "C:Python27libsite-packages will-0.9-py2.7.egg willutils.py", line 334, in get_global_form
File "C:Python27libsite-packages will-0.9-py2.7.egg willother_packages_mechanize_dist_html.py", line 521, in __getattr__
File "C:Python27libsite-packages will-0.9-py2.7.egg willother_packages_mechanize_dist_html.py", line 534, in forms
File "C:Python27libsite-packages will-0.9-py2.7.egg willother_packages_mechanize_dist_html.py", line 226, in forms
Could anyone help me out or point me in the right direction? If you think I'm going about it completely wrong please do tell me, even if you think I should use another language. Like I said this is my first program so I'm not overly attached to Python, I just had been told it was perfect for a program like this.
Sorry If I posted this question in the wrong format or something. I tried my best to adhere to the guidelines, if there's anything I need to change or more information I need to provide just let me know.
Thanks in advance for anyone who takes the time to help me, I know this probably seems like a question with an obvious answer to most of you.