Skip to main content

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

  1. Install the package:
pip install django-whoop
  1. Add django_whoop to your INSTALLED_APPS setting:
INSTALLED_APPS = [
    ...,
    'django_whoop',
]
  1. Include the WHOOP URLconf in your project's urls.py:
from django.urls import path, include

urlpatterns = [
    ...,
    path('whoop/', include('django_whoop.urls')),
]
  1. 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/dashboard to 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

django_whoop-0.1.1.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_whoop-0.1.1-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

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

Hashes for django_whoop-0.1.1.tar.gz
Algorithm Hash digest
SHA256 42133a7362e365aca5d03f5e6d64ce25945d31a9fc5a4062ab580bc18de32930
MD5 643a93b3fac141c68a38eedfa445faa5
BLAKE2b-256 8fda612533bdf2add155d87a3c0c90d03a7493f4769613d61110d7b7b6826254

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_whoop-0.1.1.tar.gz:

Publisher: publish.yml on andyreagan/django-whoop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for django_whoop-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b45eb2d8e2518531e4450a00002268c8df7c8254f094bf5ce10ab3aa746bd462
MD5 3a42f221992965f9ffc0d12d2253119c
BLAKE2b-256 9032510c5de74e3f112f731cc2f1351a7f89e60975e084a97201defbef0604f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_whoop-0.1.1-py3-none-any.whl:

Publisher: publish.yml on andyreagan/django-whoop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page