Example #1
0
def main():
    website = "http://scripts.mit.edu/~mitoc/wall/"
    current_results = []

    secs = 360

    while 1:
        
        request = requests.get(website) 

        if request.status_code != 200:
            print "fail! no access to website!"

        soup = BeautifulSoup(request.content)

        blah = soup.findAll('table', {"class":"timeline"})
        blah = blah[0]
        blah2 = blah.findAll('div', {'class': "entry open "})
        blah2 = [i.strings for i in blah2]
        out = ""
        for i in blah2:
            for j in i:
                if j.strip():
                    out += j
            out += '\n'

        timeline = out
        print timeline
        if timeline == current_results:
            print "NO NEWS!"
        elif timeline:
            # NOTIFY
            print timeline
            if current_results != timeline:
                current_results = timeline
            
                print "NEWS!"
                pyNotificationCenter.notify("NEWS!", "New Wall Climbing Times", timeline )
        else:
            print "NO NEWS!"

        time.sleep(secs)
import pyNotificationCenter

# tests

# show a message instantly
pyNotificationCenter.notify("Test message", "Subtitle", "This message should appear instantly, with a sound", sound=True)

# show a message after 20 seconds
pyNotificationCenter.notify("Another test", None, "This message appears after 20 seconds, without playing a sound", 20)
Example #3
0
	def serverNotification(self, message):
		pyNotificationCenter.notify("PyChat", "Server says:", message, sound=True)
Example #4
0
import pyNotificationCenter

# tests

# show a message instantly
pyNotificationCenter.notify(
    "Test message",
    "Subtitle",
    "This message should appear instantly, with a sound",
    sound=True)

# show a message after 20 seconds
pyNotificationCenter.notify(
    "Another test", None,
    "This message appears after 20 seconds, without playing a sound", 20)