Script to sync Whoop sleep/recovery data

I’ve been using a Whoop band for a few months and wanted to have a way to import the sleep and recovery data to intervals.icu.
Here’s a simple python script I wrote to do just that, figured I’d share it if anyone is interested:

By default it will sync today’s wellness data, but you can specify an optional date range to sync more than one day.

By the way, I know it’s possible to first sync Whoop data to Apple health and then use another apps like HealthKit or Breakaway to sync apple health data to intervals, but it doesn’t work for some fields like HRV.

Cheers

3 Likes

I would love to support WHOOP data sync as well, tho WHOOP needs a subscription to actually get to the API.

David just ordered a Whoop Device (or at least trying to as they don’t ship to the country he’s in)

1 Like

Traceback (most recent call last):
File “/Users/joe/venv/lib/python3.10/site-packages/authlib/integrations/requests_client/oauth2_session.py”, line 26, in call
req.url, req.headers, req.body = self.prepare(
File “/Users/joe/venv/lib/python3.10/site-packages/authlib/oauth2/auth.py”, line 99, in prepare
self.token[‘access_token’],
KeyError: ‘access_token’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Users/joe/Desktop/./whoop_intervalls.py”, line 105, in
main()
File “/Users/joe/Desktop/./whoop_intervalls.py”, line 92, in main
whoop_data = get_whoop_data(start_date, end_date)
File “/Users/joe/Desktop/./whoop_intervalls.py”, line 43, in get_whoop_data
recovery_collection = whoop_client.get_recovery_collection(
File “/Users/joe/venv/lib/python3.10/site-packages/whoop.py”, line 306, in get_recovery_collection
return self._make_paginated_request(
File “/Users/joe/venv/lib/python3.10/site-packages/whoop.py”, line 503, in _make_paginated_request
response = self._make_request(
File “/Users/joe/venv/lib/python3.10/site-packages/whoop.py”, line 523, in _make_request
response = self.session.request(
File “/Users/joe/venv/lib/python3.10/site-packages/authlib/integrations/requests_client/oauth2_session.py”, line 109, in request
return super().request(
File “/Users/joe/venv/lib/python3.10/site-packages/requests/sessions.py”, line 575, in request
prep = self.prepare_request(req)
File “/Users/joe/venv/lib/python3.10/site-packages/requests/sessions.py”, line 486, in prepare_request
p.prepare(
File “/Users/joe/venv/lib/python3.10/site-packages/requests/models.py”, line 372, in prepare
self.prepare_auth(auth, url)
File “/Users/joe/venv/lib/python3.10/site-packages/requests/models.py”, line 603, in prepare_auth
r = auth(self)
File “/Users/joe/venv/lib/python3.10/site-packages/authlib/integrations/requests_client/oauth2_session.py”, line 30, in call
raise UnsupportedTokenTypeError(description=description)
authlib.integrations.base_client.errors.UnsupportedTokenTypeError: unsupported_token_type: Unsupported token_type: ‘access_token’
(venv) joe@Josts-MacBook-Air Desktop % python ./whoop_intervalls.py
File “/Users/joe/Desktop/./whoop_intervalls.py”, line 36
INTERVALS_API_KEY = os.getenv(1c5r2bz5fxog6rd6elrnsdx0x)
^
SyntaxError: invalid decimal literal

???

Intervals.icu now has built in WHOOP support:

1 Like

Thank you David!