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.
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
Hi David, thanks for the guidance, very excited about this feature. Intervals and Whoop are now connected, but not all data ticked is syncing. Only resting heart rate shows on Intervals but it is not correct as compared to Whoop heart rate. Thanks for your help! Note that I am still on a free Whoop membership, could that be the reason? I disconnected and connected already, no luck.
If resting HR is not what you expected, it is almost 100% sure that it is imported from multiple sources. And the one that sticks is the one that synced last, not necessarily always the same.
Check if rHR is syncing from another source.