Skip to content

Instantly share code, notes, and snippets.

@SohanChy
Created May 6, 2017 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SohanChy/5e23f109bdc77e1dda24d443315104b4 to your computer and use it in GitHub Desktop.
Save SohanChy/5e23f109bdc77e1dda24d443315104b4 to your computer and use it in GitHub Desktop.
A python script to periodically check if SSC resulthas been published or not
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from os import popen
import threading
def check_result():
"""A python script to periodically check if SSC resulthas been published or not"""
timer = 5.0 #seconds
print("checking...")
url = 'http://mail.educationboard.gov.bd/web/result.php' # Set destination URL here
post_fields = {'board': 'com','eiin': '107536','rtype': 'SSC_FINAL'} # Set POST fields here
request = Request(url, urlencode(post_fields).encode())
json = urlopen(request).read().decode()
if("Not published" not in json):
print(json);
cmd = "firefox http://mail.educationboard.gov.bd/web/"
popen(cmd)
else:
print("Not published yet.")
#thread restarts itself every time result is not published
threading.Timer(timer, check_result).start()
check_result();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment