Python Client

The Mojave Python Client offers a convenient and Pythonic way to work with the Mojave API. Whether you're building internal tools, automating workflows, or analyzing tracked time, the client gives you a clean interface to core endpoints.

Installation

Install via pip:

Getting Started

Initialize the client with your API token:

pythonCopyEditfrom mojave import Mojave

mojave = Mojave(token="YOUR_API_TOKEN")

Basic Usage

Get current user

pythonCopyEditme = mojave.users.get_me()
print(me["name"])  # → Ada Lovelace

Create a project

pythonCopyEditproject = mojave.projects.create({
    "name": "Brand Refresh",
    "client_id": "cli_ab12cd34",
    "rate": 85,
})

Log time

pythonCopyEditmojave.time_entries.create({
    "project_id": "prj_xyz789",
    "start_time": "2025-04-10T14:00:00Z",
    "end_time": "2025-04-10T15:30:00Z",
    "notes": "UX review with client",
})

List invoices

pythonCopyEditinvoices = mojave.invoices.list()
print(len(invoices))  # → 3

Available Resources

Resource

Methods

users

get_me()list()update(id, data)

projects

list()get(id)create(data)

tasks

list(project_id)create(project_id, data)

time_entries

list()create(data)update(id, data)delete(id)

invoices

list()create(data)send(id)mark_as_paid(id)

clients

list()create(data)update(id, data)

Error Handling

The client raises MojaveError exceptions for failed requests:

from mojave.exceptions import MojaveError

try:
    mojave.projects.get("invalid_id")
except MojaveError as e:
    print(e.status)   # 404
    print(e.message)  # "Project not found"

Pagination

List methods return paginated results. Use next_page() to iterate:

entries, next_page = mojave.time_entries.list(limit=20)

while next_page:
    more_entries, next_page = next_page()
    entries += more_entries

Environment Support

Environment

Supported

Python 3.7+

Flask / FastAPI

Serverless (AWS Lambda, etc.)

Jupyter Notebook

Was this helpful?

Was this helpful?

Was this helpful?

Table of content

Table of content

Table of content

Python Client

Python Client