Created
July 26, 2018 14:37
-
-
Save ebadi/0c91d10e538256948821b78041505bbd to your computer and use it in GitHub Desktop.
Check a web page for updates
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 json | |
import time | |
import os | |
# sudo apt install sox | |
# START https://curl.trillworks.com/ | |
cookies = { | |
'xx': 'yy', | |
} | |
headers = { | |
'Pragma': 'no-cache', | |
'Accept-Encoding': 'gzip, deflate, br', | |
'Accept-Language': 'en-US,en;q=0.9', | |
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/66.0.3359.181 Chrome/66.0.3359.181 Safari/537.36', | |
'Content-Type': 'application/json', | |
'Accept': 'application/json, text/javascript, */*; q=0.01', | |
'Cache-Control': 'no-cache', | |
'X-Requested-With': 'XMLHttpRequest', | |
'Connection': 'keep-alive', | |
'Referer': 'https://google.com', | |
} | |
data = 'blah' | |
# END https://curl.trillworks.com/ | |
pres = list() | |
while (True): | |
response= requests.post('https://blahblah', headers=headers, cookies=cookies, data=data) | |
content= response.json() | |
current= content | |
if current not in pres: | |
try: | |
print content | |
except: | |
pass | |
pres.append(current) | |
# https://stackoverflow.com/questions/16573051/sound-alarm-when-code-finishes?answertab=active#tab-top | |
duration = 1 # second | |
freq = 440 # Hz | |
os.system('play --no-show-progress --null --channels 1 synth %s sine %f' % (duration, freq)) | |
time.sleep(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment