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— defaulthttps://api.hevyapp.comHEVY_API_KEY— defaultshelobs_hevy_web(web client key)HEVY_PLATFORM— defaultweb
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
Release history Release notifications | RSS feed
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23d8a1f318217757629ea30a4f8a50b4f33c9d2444d5c99b218d72ef49951d8e
|
|
| MD5 |
14b9dc258614e59d96dfde8766844574
|
|
| BLAKE2b-256 |
80a0eebb7156788ba65527383d527c4ecc08712af634ab88e9ccbd0112ec2bfb
|
Provenance
The following attestation bundles were made for hevy_unofficial-0.0.1a0.tar.gz:
Publisher:
pypi.yml on Sahil624/hevy-unofficial
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hevy_unofficial-0.0.1a0.tar.gz -
Subject digest:
23d8a1f318217757629ea30a4f8a50b4f33c9d2444d5c99b218d72ef49951d8e - Sigstore transparency entry: 1697917082
- Sigstore integration time:
-
Permalink:
Sahil624/hevy-unofficial@651ad7e1fe59315c893eaf2ec77d0222e88de325 -
Branch / Tag:
refs/tags/v0.0.1-alpha - Owner: https://github.com/Sahil624
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@651ad7e1fe59315c893eaf2ec77d0222e88de325 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hevy_unofficial-0.0.1a0-py3-none-any.whl.
File metadata
- Download URL: hevy_unofficial-0.0.1a0-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a86e61b75f107e3b976a858cd1a7e0a892638fd199f00970f6deb0631e5524b2
|
|
| MD5 |
1bc7b54d18b2cb9c2f88a736677ac7e7
|
|
| BLAKE2b-256 |
074c4f8a7366037b99f35b468f85d468b04db00a34b0c2c919a9a09bcc7055e6
|
Provenance
The following attestation bundles were made for hevy_unofficial-0.0.1a0-py3-none-any.whl:
Publisher:
pypi.yml on Sahil624/hevy-unofficial
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hevy_unofficial-0.0.1a0-py3-none-any.whl -
Subject digest:
a86e61b75f107e3b976a858cd1a7e0a892638fd199f00970f6deb0631e5524b2 - Sigstore transparency entry: 1697917172
- Sigstore integration time:
-
Permalink:
Sahil624/hevy-unofficial@651ad7e1fe59315c893eaf2ec77d0222e88de325 -
Branch / Tag:
refs/tags/v0.0.1-alpha - Owner: https://github.com/Sahil624
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@651ad7e1fe59315c893eaf2ec77d0222e88de325 -
Trigger Event:
push
-
Statement type: