Apple Store Stock Notifier

This software will immediately send you a notification via Telegram when one of your coveted Apple Devices is available in the selected Apple Stores!
In addition, it offers various tools (such as graphs) to analyze the availability of the selected devices from the comfort of your smartphone / tablet / teapot / desktop etc. (whatever Telegram runs on).
It is intended to run on an always-on device (such as a Raspberry Pi), and requires an internet connection and a Telegram account.

This software is built on a modified version of Apple-Store-Reserve-Monitor by insanoid.

Installation

How to install

  1. Clone this repository and cd to it.
  2. Execute pip install -r requirements.txt.
  3. Adapt the config.json file to your needs (see under “use”).
  4. Create a Telegram bot to inform you and enter the required details in parameters.py.
  5. Run the monitor with python monitor.py.
  6. (optional) Send /setcommands to the Telegram Botfather chat, select the bot and send the output under “Commands available:” to make the commands easily accessible from the chat.

Running the pip numpy on the Raspberry Pi can be cumbersome.
If you get errors pertaining to “Importing the numpy C-extensions failed”, try running sudo apt-get install python-dev libatlas-base-dev.

Use

It’s as simple as entering the device and Apple Store you want in config.json and running python module.py.
The model in config.json is the model part number, that can be looked up here.
The store in config.json is the store ID, a list of which can be looked up here, defaults to all stores in the zip-code region.
config.json is part of the interface of Apple Store Reserve Monitor, more information on how to use this here.

You can change the parameters regarding intervals, paths, use of proxies etc. from the defaults in parameters.py.

It is recommended to run this on a computer that is always on and always has an active internet connection (think of the environment when doing this!).
Raspberry Pi and similar computing boards are often good choices.
You may want to set up a job to start this automatically using crontab or bashrc if you are running this on a Raspberry Pi, so it can run autonomously.

Please use this software responsibly!
Do not set a low polling interval, both for your own benefit (you will be blocked) as for the other users of Apple’s service.
In general, the defaults set are fine for being notified in time.
The intended use is for people to be able to get an Apple device that is often out of stock for their own use.
Do not use this software for scalping, price gouging or any other use that is unethical.

Proxies

Randomized proxies help you make requests for a prolonged period of time without your IP-address being blocked by Apple’s server.
For this http-request-randomizer by pgaref (licensed under MIT license) is used.
If randomized proxies are enabled in parameters.py, a list of free proxies will be generated.
When a request is made, a random proxy is selected from this list.
If the proxy does not return a response within the timeout window, the proxy is removed from the list.
Because free proxies are often slow and unreliable, for each request, it will fallback to a non-proxied request after attempting a proxy unsuccesfully.
However, because unresponsive proxies are removed from the list, in most cases this random proxy system becomes reliable after a while.
Keep in mind that free proxies only remain active for a very short time (days or even hours), so if this program is ran for a long time, the list will become empty, at which point it reloads the proxy list.
Using the randomized proxies is significantly slower than direct requests, but prevent your IP address from being blocked.

Licensing

This software builts on other open source software.
As such, it is MIT licensed.

GitHub

View Github