A Django app to access WHOOP Web APIs.
Project description
django-whoop
django-whoop is a comprehensive Django app for integrating WHOOP data into your Django application. Track and visualize your recovery, sleep, strain, workouts, heart rate, and journal entries.
Features
- Complete WHOOP Data Integration: Sync recovery, sleep, strain, workouts, heart rate, and journal entries
- Dashboard: View your WHOOP data with summary statistics and recent trends
- Data Views: Detailed views for each data type (recovery, sleep, strain, workouts)
- Automatic Token Refresh: Handles WHOOP API authentication automatically
- Management Commands: Sync data via command line
- Django Admin: Full admin interface for all WHOOP data models
- Historical Data Sync: Pull all your historical WHOOP data or just recent days
Installation
- Install the package:
pip install django-whoop
- Add
django_whoopto yourINSTALLED_APPSsetting:
INSTALLED_APPS = [
...,
'django_whoop',
]
- Include the WHOOP URLconf in your project's
urls.py:
from django.urls import path, include
urlpatterns = [
...,
path('whoop/', include('django_whoop.urls')),
]
- Run migrations to create the database models:
python manage.py migrate
Quick Start
1. Authenticate with WHOOP
Visit /whoop/login and enter your WHOOP credentials to link your account.
2. Sync Your Data
After authentication, you have several options:
Via Web Interface:
- Visit
/whoop/dashboardto see your dashboard - Click "Sync Recent Data (7 days)" for quick updates
- Click "Sync All Historical Data" for complete history
Via Management Command:
# Sync recent data (last 7 days)
python manage.py sync_whoop --username <your_django_username> --recent
# Sync all historical data
python manage.py sync_whoop --username <your_django_username> --historical
# Sync specific number of days
python manage.py sync_whoop --username <your_django_username> --days 30
3. View Your Data
Navigate to:
/whoop/or/whoop/dashboard- Main dashboard with summary stats/whoop/data/recovery- Recovery scores and metrics/whoop/data/sleep- Sleep scores and duration/whoop/data/strain- Daily strain scores/whoop/data/workouts- Workout details
URL Endpoints
| URL | Description |
|---|---|
/whoop/ |
Dashboard (main view) |
/whoop/login |
Authenticate with WHOOP |
/whoop/reauth |
Re-authenticate (refresh credentials) |
/whoop/sync/recent |
Sync last 7 days of data |
/whoop/sync/historical |
Sync all historical data |
/whoop/data/recovery |
View recovery data |
/whoop/data/sleep |
View sleep data |
/whoop/data/strain |
View strain data |
/whoop/data/workouts |
View workout data |
Models
The app includes the following Django models:
- WhoopUser: Links Django user to WHOOP account with OAuth tokens
- Daily: Daily cycle data
- Recovery: Recovery scores and metrics (HRV, resting HR)
- Sleep: Sleep scores and duration breakdown
- SleepDetail: Detailed sleep session data
- Strain: Daily strain scores and heart rate data
- Workout: Individual workout sessions with zones
- HR: Heart rate measurements (6-second intervals)
- JournalEntry: Journal entries and behavior tracking
Management Commands
sync_whoop
Sync WHOOP data from the command line:
# Sync recent data (last 7 days)
python manage.py sync_whoop --username john --recent
# Sync all historical data
python manage.py sync_whoop --username john --historical
# Sync specific number of days
python manage.py sync_whoop --username john --days 30
Admin Interface
All models are registered in Django admin with custom list displays and filters. Access at /admin/ after logging in as a superuser.
API Version
This package uses WHOOP API v7 (api-7.whoop.com).
Requirements
- Django 3.2+
- Python 3.8+
- requests
- pytz
- python-dateutil
Notes
- WHOOP credentials are required for authentication
- Access tokens are automatically refreshed when needed
- Historical data sync may take several minutes depending on account age
- Heart rate data is stored at 6-second intervals
Troubleshooting
Authentication Issues:
- Ensure your WHOOP credentials are correct
- Try re-authenticating at
/whoop/reauth
Data Not Syncing:
- Check that your access token is valid (visible in admin)
- Try manual re-authentication
- Check Django logs for API errors
License
See LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_whoop-0.1.1.tar.gz.
File metadata
- Download URL: django_whoop-0.1.1.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42133a7362e365aca5d03f5e6d64ce25945d31a9fc5a4062ab580bc18de32930
|
|
| MD5 |
643a93b3fac141c68a38eedfa445faa5
|
|
| BLAKE2b-256 |
8fda612533bdf2add155d87a3c0c90d03a7493f4769613d61110d7b7b6826254
|
Provenance
The following attestation bundles were made for django_whoop-0.1.1.tar.gz:
Publisher:
publish.yml on andyreagan/django-whoop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_whoop-0.1.1.tar.gz -
Subject digest:
42133a7362e365aca5d03f5e6d64ce25945d31a9fc5a4062ab580bc18de32930 - Sigstore transparency entry: 1097151449
- Sigstore integration time:
-
Permalink:
andyreagan/django-whoop@ab4de12286bb5cdd6b0b5aa70816e4aae3d26e8e -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/andyreagan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ab4de12286bb5cdd6b0b5aa70816e4aae3d26e8e -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_whoop-0.1.1-py3-none-any.whl.
File metadata
- Download URL: django_whoop-0.1.1-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b45eb2d8e2518531e4450a00002268c8df7c8254f094bf5ce10ab3aa746bd462
|
|
| MD5 |
3a42f221992965f9ffc0d12d2253119c
|
|
| BLAKE2b-256 |
9032510c5de74e3f112f731cc2f1351a7f89e60975e084a97201defbef0604f9
|
Provenance
The following attestation bundles were made for django_whoop-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on andyreagan/django-whoop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_whoop-0.1.1-py3-none-any.whl -
Subject digest:
b45eb2d8e2518531e4450a00002268c8df7c8254f094bf5ce10ab3aa746bd462 - Sigstore transparency entry: 1097151453
- Sigstore integration time:
-
Permalink:
andyreagan/django-whoop@ab4de12286bb5cdd6b0b5aa70816e4aae3d26e8e -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/andyreagan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ab4de12286bb5cdd6b0b5aa70816e4aae3d26e8e -
Trigger Event:
push
-
Statement type: