用于在Windows 8.1中获取通知或弹出或警报的Python脚本

时间:2015-05-28 04:55:07

标签: windows python-3.x

我编写了python脚本来获取有关电子商务网站之一的缺货产品的通知。如果产品有库存,我希望使用弹出窗口,警报或引起注意的事情通知。在ubuntu我可以使用 " subprocess.Popen([' notify-send',message])"但我无法弄清楚如何在Windows中做这样的事情?
脚本: -

from urllib.request import urlopen
import re 
import subprocess 
# URL to the product
flipkart_url = 
'http://www.flipkart.com/mens-clothing/t-shirts/~spring-summer-2015/prp%5B%5D=facets.brand%255B%255D%3DNike&p%5B%5D=sort%3Dpopularity&sid=2oq%2 Cs9b%2Cj9y&ref=35e28112-55ab-43fa-b988-50e326563a89&otracker=clp_mens-clothing-t-shirts_clp%2FFlipkartFashionModule_2-1_Nike'

flipkart_fetch = str(urlopen(flipkart_url).read())
product = re.findall('Notify me when this product is in Stock',flipkart_fetch)
# message to print
if len(product) == 0:
    message = "your product is back in stock at Flipkart "
# ToDo - Notify using a pop up
else:
    print ('Your product is not available ')

0 个答案:

没有答案