Skip to content

Instantly share code, notes, and snippets.

@ehzawad
Forked from SohanChy/result_checker.py
Last active May 6, 2017 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehzawad/2fe32acac93fd727f6a1d5fc1a57890e to your computer and use it in GitHub Desktop.
Save ehzawad/2fe32acac93fd727f6a1d5fc1a57890e to your computer and use it in GitHub Desktop.
A python script to periodically check if SSC results 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 = "x-www-browser 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