Carlilock time remaining script
Posted: Sat Jun 08, 2013 11:19 pm
Hello,
I wrote a little Python script to check the time remaining on Carlilock. Note that if you have any penalties set for checking the remaining time it will trigger them.
It requires Python 2.7 and the mechanize library. You have to replace USER and PASS below with your username and password (make sure to leave the quotation marks!), respectively. By default it will suppress the minutes and seconds. I hereby release it into the public domain.
Here's how I have it set up on my computer (with Conky):

A constant reminder of my chastity!
If you have any problems with the script please let me know.
I wrote a little Python script to check the time remaining on Carlilock. Note that if you have any penalties set for checking the remaining time it will trigger them.
It requires Python 2.7 and the mechanize library. You have to replace USER and PASS below with your username and password (make sure to leave the quotation marks!), respectively. By default it will suppress the minutes and seconds. I hereby release it into the public domain.
Code: Select all
#!/usr/bin/pythonimport cookielibimport re import mechanize finder = re.compile(r'View Remaining Time</h2>\n\n <p>\n (.+?).\n') usr = 'USER'pwd = 'PASS' login_url = 'http://carlilock.com/login.php'br = mechanize.Browser()cj = cookielib.CookieJar()br.set_cookiejar(cj)br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2')]br.open(login_url)br.select_form(predicate=lambda f: 'id' in f.attrs and f.attrs['id'] == 'login')br.form['txtUserId'] = usrbr.form['txtPassword'] = pwdbr.submit()br.open('http://carlilock.com/remaining.php')text = br.response().read()res = finder.findall(text)[0].strip()print res[:res.index('hours') + 5]
A constant reminder of my chastity!
If you have any problems with the script please let me know.