Created
June 19, 2017 00:38
-
-
Save lynnntropy/db985840d62a334f2eb38fc07f726602 to your computer and use it in GitHub Desktop.
Python script that checks whether the date your RFZO health insurance is valid until has been updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import requests | |
from dateutil.parser import parse | |
from time import gmtime, strftime, sleep | |
from datetime import datetime | |
from pushbullet import Pushbullet | |
zk = "" | |
lbo = "" | |
pushbullet_key = "" | |
pb = Pushbullet(pushbullet_key) | |
print('Checker script started.') | |
last_date = None | |
while True: | |
r = requests.post("http://www.rfzo.rs/proveraUplateDoprinosa2.php", data = {'zk': zk, 'lbo': lbo}) | |
regex = 'Ваши иницијали су <strong>(.+)</strong> \(ЛБО: (.+)\)<br />Матична филијала: <strong>(.+)</strong>.<br/>Ваша здравствена књижица је оверена до: <strong>(.+)</strong>' | |
m = re.search(regex, r.text) | |
valid_date = m.group(4) | |
if last_date != None and last_date != valid_date: | |
print('DATE CHANGED: {} -> {}'.format(last_date, valid_date)) | |
pb.push_note('RFZO Validity Checker', 'Insurance now valid until: ' + valid_date) | |
print('[%s] Valid until: %s' % (datetime.now().strftime('%H:%M:%S'), valid_date)) | |
last_date = valid_date | |
sleep(60 * 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment