Created
July 4, 2016 15:36
-
-
Save dakk/c814f93a918ef9381d3ef0e5b454acb5 to your computer and use it in GitHub Desktop.
Send a desktop notification if a new house is available on Subito.it
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 time | |
from gi.repository import Notify | |
Notify.init("getCase") | |
def getCase (): | |
d = requests.get ("http://www.subito.it/annunci-sardegna/affitto/appartamenti/cagliari/cagliari/?pe=5").text | |
return int (d.split ("Tutti: ")[1].split ('<')[0]) | |
att = 0 | |
while True: | |
v = getCase () | |
if att != 0 and v != att: | |
Notify.Notification.new("Case disponibili: " + str(v) + " (" + str (v-att) + ")").show() | |
att = v | |
if att == 0: | |
att = v | |
Notify.Notification.new("Case disponibili: " + str(att)).show() | |
print "Case disponibili:", att | |
time.sleep (60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment