Created
March 24, 2015 09:35
-
-
Save skbly7/127ea119c2f54b28e9fa to your computer and use it in GitHub Desktop.
cricket score as Ubuntu notification.
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
#!/usr/bin/env python | |
import requests | |
from bs4 import BeautifulSoup | |
import pynotify | |
from time import sleep | |
def sendmessage(title, message): | |
pynotify.init("Test") | |
notice = pynotify.Notification(title, message) | |
notice.show() | |
return | |
url = "http://static.cricinfo.com/rss/livescores.xml" | |
while True: | |
r = requests.get(url) | |
while r.status_code is not 200: | |
r = requests.get(url) | |
soup = BeautifulSoup(r.text) | |
data = soup.find_all("description") | |
score = data[3].text | |
sendmessage("Score", score) | |
sleep(60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment