Skip to main content

Python client for Merit Aktiva API

Project description

merit-api

Python SDK for the Merit Aktiva API.

Installation

pip install merit-api

Usage

from merit_api import MeritAPI

client = MeritAPI(api_id="YOUR_API_ID", api_key="YOUR_API_KEY")

customers = client.customers.get_list()
invoices = client.sales.get_invoices(
    PeriodStart="2024-01-01",
    PeriodEnd="2024-01-31",
)

Features

  • deterministic request-body serialization for signing
  • configurable timeout and retry handling — retries apply only to idempotent requests; mutating writes (create invoice, create payment, …) are not retried, because Merit does not deduplicate a POST that timed out after the server already committed it, so a replay would create a duplicate. Such writes are retried only when an Idempotency-Key is supplied.
  • request and response logging hooks with secret redaction
  • optional idempotency header generation. Note: Merit's API does not deduplicate on this header, so it is not a duplicate-prevention guarantee — it only prepares for servers that honor it. Real protection comes from the duplicate guards below.
  • duplicate-write guards for purchase invoices and payments: by default purchases.send_invoice refuses a second invoice with the same vendor + BillNo, and financial.create_payment refuses a second payment referencing the same BillNo and amount. Pass allow_duplicate=True to override.
  • API-level business error parsing from HTTP 200 responses

Testing and method coverage report

Run tests:

pytest -q

Regenerate the method-level read/write coverage report:

python scripts_report_method_test_coverage.py

The report is written to reports/method_test_coverage.md and CI checks that this file stays up to date.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

merit_api-0.5.1.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

merit_api-0.5.1-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file merit_api-0.5.1.tar.gz.

File metadata

  • Download URL: merit_api-0.5.1.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for merit_api-0.5.1.tar.gz
Algorithm Hash digest
SHA256 2b80e071a9e0e10f6d23d2f1fec87f87bfc91ead2c1948bbc65e691b25fe4f3e
MD5 930f0d1773b1bb0aecd75a1922d4ffd9
BLAKE2b-256 f2bc401810cc486f0ba01d80278f6bd7ce1d43627882f377c057acc1d8f158e0

See more details on using hashes here.

File details

Details for the file merit_api-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: merit_api-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for merit_api-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d927230e1bfcdd3256b905d5d36f1ac3d45b8825da9802b7565569b42743a9f7
MD5 b491f4c975aa06cd2183a799d4942920
BLAKE2b-256 7a58232a5b8e5b17fec755cde8e86fe74d21d9c6c48ff3df66723f51aa119c8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page