Created
July 5, 2017 11:38
-
-
Save nikolak/bf6f2969278e60418303ace9ec35a483 to your computer and use it in GitHub Desktop.
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
def check_for_airpods(timeout=60): | |
import time;import os;import requests;import arrow | |
while True: | |
status = requests.get("https://www.apple.com/de/shop/retail/pickup-message?parts.0=MMEF2ZM%2FA&location=81925").json()['body']['stores'][0]['partsAvailability']['MMEF2ZM/A']['storePickupQuote'] | |
available = 'Aug im' not in status | |
if available: | |
os.system(""" osascript -e 'display notification "{}" with title "Apple Store AirPods"'""".format(status)) | |
else: | |
print(f"Last checked at {arrow.now().format('YYYY-MM-DD HH:mm')}, status= {status}", end="\r") | |
time.sleep(timeout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment