Skip to content

Instantly share code, notes, and snippets.

@ebadi ebadi/webchecker.py
Created Jul 26, 2018

Embed
What would you like to do?
Check a web page for updates
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
You can’t perform that action at this time.