Created
February 26, 2020 19:33
-
-
Save GreatBahram/c5b9843d698ae8c9863e1f42607cb0ce to your computer and use it in GitHub Desktop.
Get notified when sanjesh provide ets voucher
This file contains 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 requests | |
import bs4 | |
import sys | |
URL_ROOT = "https://ets.sanjesh.org/Register.aspx" | |
SPECIFIC_TEXT = "موجودي ووچر به پايان رسيده است" | |
def get_data(url): | |
req = requests.get(url) | |
req.raise_for_status() | |
return req.text | |
def validate(content): | |
if SPECIFIC_TEXT not in content: | |
return True | |
return False | |
def trigger(): | |
print("It's time.") | |
def main(): | |
content = get_data(URL_ROOT) | |
if not validate(content): | |
print("You have to wait, sadly...") | |
sys.exit(0) | |
trigger() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment