SleepIQ API for Python
python3 -m pip install sleepyq
To get started using the library, here’s the full usage:
>>> from sleepyq import Sleepyq >>> from pprint import pprint >>> >>> client = Sleepyq('your-login', 'your-password') >>> client.login() >>> pprint(client.sleepers()) >>> pprint(client.beds()) >>> pprint(bed_family_status())
The API is undocumented, so this library does not make much attempt to structure the data from the API into objects.
The SleepIQ API was announced at CES 2016 but there has yet to be any public documentation.
https://sleepiq.sleepnumber.com appears to use the SleepIQ API internally, and methods here were written based on observing use of the site with Chrome Developer Tools. There was also prior art at https://github.com/erichelgeson/sleepiq (the API has changed since then) and https://github.com/natecj/sleepiq-php
The first request to happen is to login. This returns a key (_k) that needs to be used on subsequent requests as a parameter. Subsequent requests also need to be part of the same ‘session’, since those calls expect some cookies to be set.