Skip to content

Instantly share code, notes, and snippets.

@nikolak
Created July 5, 2017 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikolak/bf6f2969278e60418303ace9ec35a483 to your computer and use it in GitHub Desktop.
Save nikolak/bf6f2969278e60418303ace9ec35a483 to your computer and use it in GitHub Desktop.
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