Skip to main content

Unofficial Python client for the Hevy workout API (api.hevyapp.com)

Project description

hevy-unofficial

Unofficial Python client for the Hevy workout API (api.hevyapp.com).

Disclaimer: Not affiliated with Hevy. The API is undocumented and may change. Use at your own risk and respect Hevy's terms of service.

Install

pip install hevy-unofficial

Development install from source:

pip install -e "packages/hevy[dev]"

Quick start

Use tokens from a browser session or from POST /login (login requires reCAPTCHA on web):

from hevy_unofficial import HevyClient

with HevyClient(
    access_token="YOUR_ACCESS_TOKEN",
    refresh_token="YOUR_REFRESH_TOKEN",
) as client:
    account = client.users.get_account()
    print(account["username"])

    routines = client.routines.list()
    workouts = client.workouts.list_paged(username=account["username"], limit=10)

Environment variables (optional):

  • HEVY_BASE_URL — default https://api.hevyapp.com
  • HEVY_API_KEY — default shelobs_hevy_web (web client key)
  • HEVY_PLATFORM — default web

Credential cache

Tokens can be cached by email and updated automatically after refresh:

from hevy_unofficial import CredentialStore, prompt_client

store = CredentialStore()  # ~/.config/hevy-unofficial/credentials.json
with prompt_client(store=store) as client:
    ...

On first run you are prompted for email and tokens; later runs reuse the cache.

API surface

The client mirrors the web app's HTTP API:

Attribute Domain
client.auth Login, signup, refresh, logout, passwords
client.users Account, profile, preferences, API keys
client.routines Routines, folders, sync batch, reorder
client.workouts History, comments, likes, metrics, calendar
client.exercises Built-in catalog (cached), custom templates, history
client.social Feed, follow, followers
client.coach Coach invites and trainer program
client.billing Paddle / Stripe subscription helpers
client.misc Webhooks, OAuth, uploads, feedback

Exercise catalog

Built-in templates are extracted from hevy.com's _app-*.js bundle (not the REST API):

# Cached for 7 days in ~/.config/hevy-unofficial/exercise_catalog.json
exercises = client.exercises.list_catalog()

# Force ETag check / re-download if the bundle changed
exercises = client.exercises.list_catalog(refresh=True)

Offline extraction from a saved JS file:

client.exercises.parse_catalog_from_js("path/to/_app-xxx.js")

Routines example

# List all routines (sync)
data = client.routines.list()

# Create
created = client.routines.create({
    "title": "Push Day",
    "exercises": [],
    "folder_id": None,
    "index": 0,
    "program_id": None,
    "notes": None,
    "coach_force_rpe_enabled": False,
})
routine_id = created["routineId"]

# Update
client.routines.update(routine_id, {
    "title": "Push Day A",
    "exercises": [...],
    "folder_id": None,
    "index": 0,
    "program_id": None,
    "notes": None,
    "coach_force_rpe_enabled": False,
})

# Delete
client.routines.delete(routine_id)

Publishing to PyPI

Push a version tag (must match version in pyproject.toml):

git tag v0.1.0
git push origin v0.1.0

GitHub Actions builds the wheel/sdist and publishes to PyPI (requires a PYPI_API_TOKEN repository secret or PyPI trusted publishing for this repo).

Manual upload:

cd packages/hevy
pip install build twine
python -m build
twine upload dist/*

Tests

cd packages/hevy
pytest

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

hevy_unofficial-0.0.1a0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

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

hevy_unofficial-0.0.1a0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file hevy_unofficial-0.0.1a0.tar.gz.

File metadata

  • Download URL: hevy_unofficial-0.0.1a0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hevy_unofficial-0.0.1a0.tar.gz
Algorithm Hash digest
SHA256 23d8a1f318217757629ea30a4f8a50b4f33c9d2444d5c99b218d72ef49951d8e
MD5 14b9dc258614e59d96dfde8766844574
BLAKE2b-256 80a0eebb7156788ba65527383d527c4ecc08712af634ab88e9ccbd0112ec2bfb

See more details on using hashes here.

Provenance

The following attestation bundles were made for hevy_unofficial-0.0.1a0.tar.gz:

Publisher: pypi.yml on Sahil624/hevy-unofficial

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

File details

Details for the file hevy_unofficial-0.0.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for hevy_unofficial-0.0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 a86e61b75f107e3b976a858cd1a7e0a892638fd199f00970f6deb0631e5524b2
MD5 1bc7b54d18b2cb9c2f88a736677ac7e7
BLAKE2b-256 074c4f8a7366037b99f35b468f85d468b04db00a34b0c2c919a9a09bcc7055e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for hevy_unofficial-0.0.1a0-py3-none-any.whl:

Publisher: pypi.yml on Sahil624/hevy-unofficial

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