Skip to content

Instantly share code, notes, and snippets.

@madmaximux
Forked from sjwhitworth/iphone6_coventgarden.py
Created September 25, 2021 19:59
Show Gist options
  • Select an option

  • Save madmaximux/a34fdbbaff029bcd787e835aa696a0d7 to your computer and use it in GitHub Desktop.

Select an option

Save madmaximux/a34fdbbaff029bcd787e835aa696a0d7 to your computer and use it in GitHub Desktop.
iPhone 6 Stock Checker
import requests
import datetime
import time
url = "https://reserve.cdn-apple.com/GB/en_GB/reserve/iPhone/availability.json"
interested_stores = ['R245']
# Exclude iPhone 6
excluded = ['MGA92B/A', 'MGA92B/A', 'MGAJ2B/A', 'MGAE2B/A', 'MGAA2B/A',
'MGAK2B/A', 'MGAF2B/A', 'MGA82B/A', 'MGAH2B/A', 'MGAC2B/A']
while True:
true_count = 0
dat = requests.get(url).json()
last_updated = datetime.datetime.fromtimestamp(float(str(dat['updated'])[0:-3]))
print last_updated
for k,v in dat.items():
if k in interested_stores:
for i, s in v.items():
if i not in excluded and s == True:
true_count += 1
if true_count > 0:
print 'iPhone 6 stock in Covent Garden!'
time.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment