Metadata-Version: 2.4
Name: momence-api
Version: 0.1.0
Summary: Unofficial Python client for the Momence API — book classes, manage bookings, and list sessions
Author: Saline Jiang
License: MIT
Project-URL: Homepage, https://github.com/salinejiang/momence-api
Project-URL: Repository, https://github.com/salinejiang/momence-api
Project-URL: Issues, https://github.com/salinejiang/momence-api/issues
Keywords: momence,fitness,yoga,booking,api
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28.0
Dynamic: license-file

# momence-api

Unofficial Python client for the [Momence](https://momence.com) API. Book fitness classes, manage bookings, and list sessions at any Momence-powered studio (yoga, pilates, CrossFit, dance, etc.).

## Installation

```bash
pip install momence-api
```

## Quick Start

### As a Python library

```python
from momence import MomenceClient

client = MomenceClient("you@example.com", "your-password")

# List sessions at a studio (no auth required)
sessions = client.list_sessions(host_id=5610, start="2026-04-01", end="2026-04-07")
for s in sessions:
    print(f"{s['starts_at']} — {s['title']} ({s['teacher']})")

# Book a class (auto-detects your compatible membership)
result = client.book(session_id=131944193, host_id=5610)
print(result)  # {"status": "success", "payload": {...}}

# View your upcoming bookings
bookings = client.my_bookings(host_id=5610)
for event in bookings["payload"]["events"]:
    print(f"{event['startsAt']} — {event['name']}")

# Cancel a booking
client.cancel(booking_id=299044233)
```

### As a CLI tool

```bash
export MOMENCE_EMAIL="you@example.com"
export MOMENCE_PASSWORD="your-password"

# List available classes
momence list-sessions --host-id 5610 --start 2026-04-01 --end 2026-04-07

# Book a class
momence book --session-id 131944193 --host-id 5610

# View your bookings
momence my-bookings --host-id 5610

# Cancel a booking
momence cancel --booking-id 299044233

# Show your account info
momence user
```

## Finding Your Studio's Host ID

Every Momence-powered studio has a unique host ID. You can find it by:

1. Going to your studio's website
2. Looking at the Momence booking widget URL — it will contain `hostId=XXXX`
3. Or checking the studio's Momence page URL: `momence.com/u/studio-name`

## API Reference

### `MomenceClient(email, password, token_path=None)`

Create a client instance. Tokens are cached at `~/.config/momence/token.json` by default.

### Methods

| Method | Auth Required | Description |
|--------|:---:|-------------|
| `list_sessions(host_id, start?, end?)` | No | List available sessions for a studio |
| `list_dates(host_id)` | No | List dates with available sessions |
| `book(session_id, host_id, membership_id?)` | Yes | Book a session (auto-detects membership if omitted) |
| `cancel(booking_id)` | Yes | Cancel a session booking |
| `my_bookings(host_id?)` | Yes | List upcoming bookings |
| `get_user()` | Yes | Get current user info |
| `get_compatible_memberships(session_id)` | Yes | List memberships compatible with a session |

### Properties

| Property | Description |
|----------|-------------|
| `member_id` | Your Momence member ID |
| `first_name` | Your first name |
| `last_name` | Your last name |

## Disclaimer

This is an unofficial client that uses the same API as the Momence mobile app. It is not affiliated with or endorsed by Momence. Use at your own risk — API changes in the Momence app could break this library.

## License

MIT
