Official Python SDK for the WorkoutX API — exercises, GIFs, workouts, supplements, and body scan.
Project description
workoutx-sdk (Python)
Official Python SDK for the WorkoutX API — exercises, GIFs, workout generator, supplements, and the Body Scan product, in one client.
Python 3.8+. Only depends on certifi (for reliable TLS across platforms).
Install
pip install workoutx-sdk
Quick start
from workoutx import WorkoutX
wx = WorkoutX(
api_key="wx_your_key_here", # exercises / gifs / workout / supplements
scan_token="eyJ...", # body scan (optional)
)
# Exercises
page = wx.exercises.list(limit=20)
by_id = wx.exercises.get("0001")
lunges = wx.exercises.by_name("lunges")
similar = wx.exercises.similar("0001")
alts = wx.exercises.alternatives("0001", equipment="dumbbell")
# GIFs
data = wx.gifs.get("0001") # bytes
src = wx.gif_url("0001") # URL for <img>
# Workout & supplements
workout = wx.workout.generate(goal="hypertrophy", days=4)
stack = wx.supplements.stack(goal="cut")
# Body Scan
credits = wx.scan.credits()
history = wx.scan.history(limit=10)
# Account & billing
login = wx.auth.login("u@x.com", "•••") # token cached for scan/auth/billing
me = wx.auth.me()
keys = wx.auth.list_keys()
sub = wx.billing.status()
checkout = wx.billing.checkout("pro", "yearly") # -> {"url": ...} to redirect to Stripe
Authentication
| Product | Resources | Credential |
|---|---|---|
| Exercises | exercises, gifs, workout, supplements |
api_key (wx_...) |
| Body Scan / Account / Billing | scan.*, auth.*, billing.* |
Bearer JWT |
auth, scan, and billing share the same Bearer token — a successful
auth.login() caches it, so later scan.* / billing.* calls work without
re-supplying credentials. Google OAuth (/v1/auth/google) is a browser-redirect
flow and is intentionally not wrapped.
For Body Scan, pass a ready token or let the SDK log in for you:
WorkoutX(api_key=key, scan_token="eyJ...") # ready token
WorkoutX(api_key=key, scan_email="u@x.com", scan_password="•") # auto-login
Avoiding the "name as ID" 404
exercises.get(id) needs an exact numeric ID (IDs have gaps). For names, use
by_name, or the resolver that tries an ID then falls back to a name search:
ex = wx.exercises.find("lunges") # dict | None
Error handling
from workoutx import WorkoutXError
try:
wx.exercises.get("nope")
except WorkoutXError as e:
e.status # 404
e.code # "Not Found"
e.tip # hint from API, when present
e.is_not_found # plus is_auth_error, is_rate_limited
Transient failures (429, 5xx, network) are retried automatically with backoff,
honoring Retry-After.
Development
pip install -e ".[test]"
pytest # 25 offline unit tests (no network)
License
MIT
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 workoutx_sdk-0.1.0.tar.gz.
File metadata
- Download URL: workoutx_sdk-0.1.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06805d434d669a40d41e3687ef4d804afd08a1499be06c98590f8c9fb101ce13
|
|
| MD5 |
ef96e57a89fdc754d474ba4afbc9a47c
|
|
| BLAKE2b-256 |
807f4a8060dc1ab7710ccf47691fc49846056059f7614c443848b43498818d6a
|
File details
Details for the file workoutx_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: workoutx_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2aae28e8ec6caaff155654138ae1ce8afa8a5b88791ea406931199855b797728
|
|
| MD5 |
319cfcdbdf8b73623cf238536b97ab8d
|
|
| BLAKE2b-256 |
3e264907bc50fbad56de56695bbdc5457d873e4bed51e6a77bebd7ee1d82edf0
|