Skip to content

Instantly share code, notes, and snippets.

@GreatBahram
Created February 26, 2020 19:33
Show Gist options
  • Save GreatBahram/c5b9843d698ae8c9863e1f42607cb0ce to your computer and use it in GitHub Desktop.
Save GreatBahram/c5b9843d698ae8c9863e1f42607cb0ce to your computer and use it in GitHub Desktop.
Get notified when sanjesh provide ets voucher
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