Last active
September 20, 2017 13:49
-
-
Save myusuf3/20aec2acbff99c3b00bd0b728476335a to your computer and use it in GitHub Desktop.
script to check if apple site is up and running again.
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
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