0

Basically I want to make a simple bot that makes a beep or notification when my grades get published to this webpage.

I have already figured out how to log in using http basic auth and can navigate to the webpage however what would be the best way to check if a new entry has been added?

Here is the page source https://pastebin.com/rbyzJGtY

Here is what the webpage looks like. http://imgur.com/a/HcPNq

Not looking for a handout just some methods I can look into to do this. Also it does not need to be fancy, Literally just want it to check every 15 minutes or so and beep if something has appeared.

Jerry Stratton
  • 3,287
  • 1
  • 22
  • 30
Rick1990
  • 95
  • 12

1 Answers1

2

With python you can use schedule, time and requests libraries to do what you want. Something like:

import requests
import schedule
import time

lastRes = requests.get(URL).text

def check():
    newRes = requests.get(URL).text
    if (newRes == lastRes):
        // Do Something
        lastRes = newRes


schedule.every(15).minutes.do(check)

while 1:
    schedule.run_pending()
    time.sleep(1)

I haven't used the schedule or time libs before, got them from here ( How do I get a Cron like scheduler in Python? ) but seems like the right idea.

James Wesc
  • 81
  • 1
  • 9
  • This solution should work. I'd suggest you scheduled your tasks with your OS' task scheduler, however. And instead of comparing the entire HTML of different versions of the site, I'd try to pinpoint the area that's supposed to be updated with the grades, and just compare different versions of the HTML of that area. – Luis Alvarez Jun 20 '17 at 02:21
  • Thank you for the reply I will try this tonight when I get home – Rick1990 Jun 20 '17 at 03:33