SHARE
TWEET

geofront_issue_monitor.py

a guest Feb 28th, 2020 127 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2. import re
  3. from time import sleep
  4. from datetime import datetime
  5. import ctypes
  6. import threading
  7. MessageBox = ctypes.windll.user32.MessageBoxW
  8.  
  9. def check_issues():
  10.     f = None
  11.     while f is None:
  12.         try:
  13.             f=requests.get('https://geofront.esterior.net/',timeout=120)
  14.         except:
  15.             sleep(1200)
  16.  
  17.     try:
  18.         issues = re.search(r'''<p style="font-family:'Orbitron', sans-serif; font-size:40px; text-align: center; background-color: #000000; color: #ffffff;">(.+?)</p>''', f.text, re.MULTILINE).groups()[0]
  19.         print(str(datetime.today()) + " " + issues)
  20.     except:
  21.         issues = "not found"
  22.     return(issues)
  23.  
  24. prev_issues = ""
  25.  
  26. while True:
  27.         cur_issues = check_issues()
  28.         if cur_issues != prev_issues:
  29.             threading.Thread(target=MessageBox, args=(None, 'Current GeoFront Issue Count at ' + str(datetime.today()) + ': ' + cur_issues  + '\r\n', 'GeoFront Issues Update', 0x00001000)).start()
  30.             prev_issues = cur_issues
  31.         sleep(1200)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top