Created
August 22, 2011 16:03
-
-
Save fission6/1162763 to your computer and use it in GitHub Desktop.
newegg touchpad watcher
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 urllib2 | |
from time import sleep | |
from datetime import datetime | |
from subprocess import Popen | |
PRODUCT_URL = "http://content.newegg.com/LandingPage/ItemInfo4ProductDetail.aspx?Item=N82E16834158004" | |
def check(): | |
""" | |
Check product url and look for 'Out of Stock' in the specified xpath. | |
If not found, then the product maybe in stock, so BEEP. | |
""" | |
time_check = datetime.now() | |
page = urllib2.urlopen(PRODUCT_URL).read() | |
is_lowered = '"finalPrice":"399.99"' not in page | |
if is_lowered: | |
print time_check, "Touchpad has possibly lowered price" | |
#Show a zenity popup | |
Popen("zenity --info --text 'HP Touchpad may have lower price'", shell=True) | |
else: | |
print time_check, "Touch pad has not lowered price" | |
def main(): | |
while True: | |
check() | |
sleep(30) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment