Skip to main content

build downloads Ruff

Python Mopé

Client library for Mopé by Hakrinbank

Token acquisition and API Docs

Requirements

  • Python 3.11 or newer
  • Mopé API Token

Getting Started

First, install from PyPi by running pip install python-mope

Example usage:

from mope import Mope

mope = Mope(token="test_123")
mope.shop.get_payment_request(payment_id="123")

Timeouts and errors

Requests use a 5-second connect timeout and a 30-second read timeout by default. Configure both with Mope(token="test_123", timeout=(3.0, 15.0)), or pass a single number of seconds to apply to both. mope.client.Client accepts the same keyword argument. Values must be finite and greater than zero. The read timeout limits inactivity between received bytes, not the total duration of a request.

Shop methods raise mope.errors.MopeAPIError for HTTP errors. It is a subclass of requests.HTTPError, so existing handlers keep working. Its status_code, code, message, and data fields expose the HTTP status and validated Mopé error details, such as code 1033 for account limits exceeded. If the error body is missing or malformed, code and data are None and message retains the HTTP error description. The original response and exception cause are preserved.

Connection failures and timeouts remain requests.RequestException subclasses. Malformed successful responses still raise TypeError, ValueError, or KeyError; invalid JSON raises requests.exceptions.JSONDecodeError, which is also a ValueError. Applications should translate these errors at the API call boundary and decide which failures are retryable. Requests are not automatically retried, including payment creation after a timeout.

Development

Install uv, then run:

uv sync --locked
uv run --locked ruff check .
uv run --locked ruff format --check .
uv run --locked ty check
uv run --locked pytest
uv build --no-sources

Development uses Python 3.15.2 from .python-version; uv installs it when needed. The library supports Python 3.11+, and CI tests the built wheel on Python 3.11, 3.12, 3.13, 3.14, and 3.15. Ruff and ty target Python 3.11 compatibility. Run uv run ruff format . to format code. Commit uv.lock after changing dependencies; use uv lock --upgrade to refresh their locked versions.

The package includes inline types and a py.typed marker. API responses are validated before creating models: invalid field types raise TypeError, invalid status values raise ValueError, and missing required fields raise KeyError. Values are not coerced. Payment metadata remains a list of dictionaries with string key and value fields, as defined by the Mopé API schema.

Publishing

To release, update mope/__version__.py, run uv lock, and commit the changes. Publish a GitHub release whose tag is the package version or v followed by that version. The workflow checks the tag, runs lint, formatting and type checks, builds the source distribution and wheel, and tests the installed wheel across all supported Python versions before uploading those same artifacts to PyPI.

Resources

shop

Methods

shop.create_payment_request
Argument Type Required
amount int yes
description string yes
order_id string yes
currency enum (USD, SRD, EUR) yes
redirect_url string yes

return type: mope.models.payments.CreatePaymentResponse

shop.get_payment_request
Argument Type Required
payment_id string yes

return type: mope.models.payments.PaymentRequest

Metadata

Release files for python-mope 0.3.1

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

Source distribution (sdist)

Source distribution for python-mope 0.3.1
File Size Uploaded Provenance Actions
python_mope-0.3.1.tar.gz 12.5 kB Without provenance Details for python_mope-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-mope 0.3.1
File Interpreter ABI Platform Actions
python_mope-0.3.1-py3-none-any.whl Python 3 none any Details for python_mope-0.3.1-py3-none-any.whl

Total release size: 22.3 kB

Release files / python_mope-0.3.1.tar.gz

Download URL python_mope-0.3.1.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
59b2470d44d3d0281079b298c116e34a1c68afb95bc36c2fd904998b89b57a5b
BLAKE2b-256 checksum
How to use checksums
1905c171a26d6af4ed4fb6881fcfe9ac5141d1b361b278aeddbaca8278206bd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / python_mope-0.3.1-py3-none-any.whl

Download URL python_mope-0.3.1-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0651f1480b1fa34ee728c2cfc78728b69c79eec9a31dc86931f3588f99470c74
BLAKE2b-256 checksum
How to use checksums
a87e8360f8396780e87eaa6db614c145a2d495f1ae8e4c7670660b39eb5464b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for python-mope 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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