Skip to main content

mpt-curl

Python replacement for ~/bin/mpt-curl built on mpt-api-python-client.

For GET requests to collection endpoints, pages are fetched automatically and streamed to stdout as a single JSON object ({"data":[...], "$meta":{...}}).

The first request is sent as-is. Auto-paging starts only if the response has $meta.pagination; further pages use limit=1000 by default. With total in pagination, paging follows it; otherwise it continues while each page is full. Disabled when the URL contains limit= or offset=.

Install

pip install mpt-curl

Configuration

Uses the active account from mpt-cli accounts (~/.swocli/accounts.json, is_active: true), same as the shell wrapper.

Override with environment variables:

  • MPT_API_BASE_URL
  • MPT_API_TOKEN

Usage

# List agreements (auto-paged)
mpt-curl /commerce/agreements

# Same with /public/v1 or /v1 prefix — resolved like the shell script
mpt-curl /public/v1/commerce/agreements
mpt-curl /v1/commerce/agreements
mpt-curl /commerce/agreements

# Filter with RQL
mpt-curl '/commerce/agreements?and(eq(status,Active))'

# Single page (limit= or offset= in URL disables auto-paging)
mpt-curl '/commerce/agreements?limit=10'

# POST (-d alone implies POST, like curl)
mpt-curl /commerce/orders -d '{"type":"Change","agreement":{"id":"AGR-123"}}'
mpt-curl -X POST /commerce/orders -d '{"type":"Change","agreement":{"id":"AGR-123"}}'

# PUT with body
mpt-curl -X PUT /commerce/orders/ORD-123 -d '{"status":"Processing"}'

Options

Flag Description
-X METHOD HTTP method (default: GET, or POST when -d is given)
-d DATA Request body (JSON)
-H NAME:VALUE Extra header
--no-page Disable automatic paging
--page-size N Page size for auto-paging (default: 1000)
--compact Compact JSON output
-v Log requests, status, and paging to stderr (gray when stderr is a TTY)
-vv Also include response headers

Automatic paging is also disabled when the URL already contains limit= or offset=.

Development

From a checkout:

uv sync --group dev
uv run pytest

Metadata

Release files for mpt-curl 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mpt-curl 1.0.8
File Size Uploaded
mpt_curl-1.0.8.tar.gz 36.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mpt-curl 1.0.8
File Interpreter ABI Platform
mpt_curl-1.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 46.9 kB

Release files / mpt_curl-1.0.8.tar.gz

Download URL mpt_curl-1.0.8.tar.gz
Size 36.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8011114ba7f5f434dcdf08ca2cb2abd7bf3a1a4580f80c08f2f744e21b4dd1d4
BLAKE2b-256 checksum
How to use checksums
cef9d647ccb6326a01e8b703af3d7fe7f51e0f9da3c52b980a8d0c6562bf8a2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mpt_curl-1.0.8-py3-none-any.whl

Download URL mpt_curl-1.0.8-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37660998f50142fee5d4a30f1b758fd0841577162b03060663b9291bf7c98cf3
BLAKE2b-256 checksum
How to use checksums
43db80fa35b6270045253173b97714625b741baea8489bc80512d5045d0ca869
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.0.8 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page