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.2.tar.gz (24.1 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.2-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file django_whoop-0.1.2.tar.gz.

File metadata

  • Download URL: django_whoop-0.1.2.tar.gz
  • Upload date:
  • Size: 24.1 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.2.tar.gz
Algorithm Hash digest
SHA256 4eac69318c4a0622108310f6cc017d1ff58274921c92e053b005d14afc291dfa
MD5 91786fde11fc935bf454eed724f9c0e9
BLAKE2b-256 f828f0aec48b30030802ae9150be8f4afc75221b0011045b4c35e385c9e08cf5

See more details on using hashes here.

Provenance

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

Publisher: ci.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.2-py3-none-any.whl.

File metadata

  • Download URL: django_whoop-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6278c101adef916e9e25a67d7a2b5546dbec48e14f83e030b699bfabdd103b1c
MD5 8a7b7fd11e355c29b9f401b137e1624a
BLAKE2b-256 983f1f36996eb3f7d9d7ce572d3332bf0d2c4342f1cc0aaa5ff7618ff689baf0

See more details on using hashes here.

Provenance

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

Publisher: ci.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