Skip to content

Instantly share code, notes, and snippets.

@myusuf3
Last active September 20, 2017 13:49
Show Gist options
  • Save myusuf3/20aec2acbff99c3b00bd0b728476335a to your computer and use it in GitHub Desktop.
Save myusuf3/20aec2acbff99c3b00bd0b728476335a to your computer and use it in GitHub Desktop.
script to check if apple site is up and running again.
from lxml import etree, html
import time
import requests
def main():
response = requests.get('https://store.apple.com/ca/')
body = response.text
xpathselector = '/html/body/div[3]/div/img'
tree = html.fromstring(body)
data = tree.xpath(xpathselector)
if len(data) == 0:
print "Its out!!"
else:
print "Not yet!"
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment