My python auto-login script is broken.
- by user310392
A long time ago, I wrote a little python script to automatically log me on to the wireless network at my office.
Here is the code:
#!/opt/local/bin/python
from urllib2 import urlopen
from ClientForm import ParseResponse
try:
if "Logged on as" in urlopen("https://MYWIRELESS.com/logon").read():
print "Already logged on."
else:
forms = ParseResponse(urlopen("https://MYWIRELESS.com/logon"), backwards_compat=False)
form = forms[0]
form["username"], form["password"] = "ME", "MYPASSWD"
urlopen(form.click())
print "Logged on. (probably :-)";
except IOError, e: print "Couldn't connect to wireless login page:\n", e
I changed computers recently, and it stopped working. Now, I get the error:
File "login.txt", line 4, in <module>
from ClientForm import ParseResponse
ImportError: No module named ClientForm
which makes it look like I don't have some package (ClientForm) installed, so I installed it (sudo port install py-clientform), but I still get the same error. Does anyone have an idea what I'm doing wrong?