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 = "email@example.com" # email for opendns password = "thisisthepassword" # password for opendns b = get_browser() b.go("https://dashboard.opendns.com/") b.showforms() fv("2", "username", username) fv("2", "password", password) showforms() submit("sign-in") b.showforms() b.go ("https://dashboard.opendns.com/settings/*MYNETWORKID*/content_filtering") # 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 b.showforms()
Now that's where my problem starts. On that last b.showforms() I get an error:
Traceback (most recent call last): File "<pyshell#43>", line 1, in <module> b.showforms() File "C:\Python27\lib\site-packages\twill-0.9-py2.7.egg\twill\browser.py", line 225, in showforms forms = self.get_all_forms() File "C:\Python27\lib\site-packages\twill-0.9-py2.7.egg\twill\browser.py", line 259, in get_all_forms global_form = self._browser.global_form() File "C:\Python27\lib\site-packages\twill-0.9-py2.7.egg\twill\other_packages\_mechanize_dist\_mechanize.py", line 446, in global_form return self._factory.global_form File "C:\Python27\lib\site-packages\twill-0.9-py2.7.egg\twill\utils.py", line 334, in get_global_form return self.factory.global_form File "C:\Python27\lib\site-packages\twill-0.9-py2.7.egg\twill\other_packages\_mechanize_dist\_html.py", line 521, in __getattr__ self.forms() File "C:\Python27\lib\site-packages\twill-0.9-py2.7.egg\twill\other_packages\_mechanize_dist\_html.py", line 534, in forms self._forms_factory.forms()) File "C:\Python27\lib\site-packages\twill-0.9-py2.7.egg\twill\other_packages\_mechanize_dist\_html.py", line 226, in forms raise ParseError(exc) ParseError: <unprintable ParseError object>
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.