DoctorNick Nov 29th, 2013 2,771 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- #Put this in the root of your home directory
- #put this in crontab, set it to like every *30* minutes (it'll blacklist you for hammering if you don't)
- #this uses pushover. It's 5 bucks on the app store, but it's worth it.
- #you need to install the python-crontab and pushnotify python packages for this script.
- #just do "pip install python-crontab" and "pip install pushnotify"
- import requests, time
- import pushnotify
- from pushnotify import get_client
- from crontab import CronTab
- #this sets it to ALERT priority, which means that it'll keep bugging you every 30 seconds until you acknowledge
- blag = dict(priority=2, retry=30, expire=86399, url='https://dognzb.cr/register', url_title='register link')
- #put your pushover api key here.
- apikey = 'YOUR API KEY GOES HERE'
- #put your app api key here.
- client = get_client('pushover', 'YOUR APP API KEY GOES HERE', 'dognzb notify')
- r = requests.get('https://dognzb.cr/register', allow_redirects=False)
- if (r.status_code == 200):
- client.notify('DogNZB Registration open!', 'ITS OPEN!!!!!!!!!!!', split=True, kwargs=blag)
- #put the command you used when you first installed this in crontab
- cmd = 'python ~/check.py'
- #replace this with your username
- tab = CronTab(user='nick')
- cron_job = tab.find_command(cmd)
- if len(cron_job) > 0:
- #removes the job from cron once it notifies you
RAW Paste Data