Created
May 6, 2013 04:30
-
-
Save ricardodani/5523355 to your computer and use it in GitHub Desktop.
Bot pra avisar quando o site do tickets for fun não está busy
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
# -*- encoding: utf-8 -*- | |
import requests | |
import sys | |
import time | |
def play_sound(): | |
sys.stdout.write('\a') | |
def is_tff_busy(): | |
url = 'http://www.ticketsforfun.com.br/' | |
req = requests.get(url) | |
if req.ok and 'tryAgainButton' not in req.content: | |
return True | |
else: | |
return False | |
def sleep(): | |
time.sleep(5) | |
while True: | |
if not is_tff_busy(): | |
print 'Site on!' | |
play_sound() | |
else: | |
print 'Site busy!' | |
sleep() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment