skillfed

mastercard-oauth1-signer

Mastercard OAuth1 Signer.

mastercard-oauth1-signer v1.9.2 230.5K downloads/30d#9,108 on PyPI31
Permissive license MIT Active released

What it is and what it does

This library implements OAuth 1.0a signature generation specifically for Mastercard API authentication. It handles the cryptographic signing of HTTP requests using either RSA-SHA256 (default) or RSA-PSS-SHA256 algorithms, producing properly formatted Authorization headers that comply with Mastercard's API requirements.

The package provides multiple integration patterns: direct header generation via `OAuth.get_authorization_header()`, signing of request objects through the `OAuthSigner` class, and seamless integration with the requests library via the `OAuth1RSA` authentication handler. It manages key loading, payload hashing (including body hash for non-form-encoded content), and OAuth parameter construction, abstracting away the complexity of manual signature computation.

Use it for:

  • Authenticate requests to Mastercard sandbox or production APIs when building payment or financial applications.
  • Sign HTTP requests in backend services that need to call Mastercard endpoints with OAuth 1.0a credentials.
  • Integrate OAuth signing into OpenAPI-generated client libraries targeting Mastercard services.
  • Implement custom request signing logic for Mastercard API calls within larger Python applications.
  • Switch between RSA-SHA256 and RSA-PSS-SHA256 signature methods based on Mastercard API endpoint requirements.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates OAuth 1.0a-compliant signatures for Mastercard API requests using RSA-SHA256 or RSA-PSS-SHA256 cryptographic methods.

Yes. Install this if you are building a Python application that needs to authenticate with Mastercard APIs. The library is actively maintained, has low install friction, carries no known vulnerabilities, and is licensed permissively. The only caveat is that Python 3.8/3.9 support will be dropped in v2.0.0, so plan upgrades accordingly if you depend on those versions.

Install

mastercard-oauth1-signer on PyPI

pip

pip install mastercard-oauth1-signer

uv

uv add mastercard-oauth1-signer

poetry

poetry add mastercard-oauth1-signer

Installing mastercard-oauth1-signer

Before you install

Low friction: pure Python wheel with four stable runtime dependencies (cryptography, urllib3, requests, Deprecated). Active maintenance with recent commits; current version targets Python 3.8–3.12 with deprecation warnings on 3.8/3.9 ahead of v2.0.0.

License in practice

MIT license permits unrestricted use, modification, and distribution in commercial and private projects with minimal attribution requirements.

Quickstart

pip install mastercard-oauth1-signer

import oauth1.authenticationutils as authenticationutils
from oauth1.oauth import OAuth, SignatureMethod

signing_key = authenticationutils.load_signing_key('path/to/key', '')
authHeader = OAuth.get_authorization_header(
    'https://sandbox.api.mastercard.com/service',
    'POST',
    'Hello world!',
    consumer_key,
    signing_key
)

Requires a valid Mastercard Developer Portal account with consumer key and private signing key credentials.

Verify before relying

  • Whether the library supports custom HTTP clients beyond requests and the OAuthSigner class.
  • Performance characteristics when signing high-volume requests or with large payloads.
  • Specific error handling and exception types raised by the library.

Package facts

License MIT (permissive)
Python support capped below the current Python release (<3.13,>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 4 — cryptography, urllib3, Deprecated, requests
Maintenance actively maintained — 123 days since the last release
Last repo commit
First released
Downloads 230,478/month — #9,108 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mastercard_oauth1_signer-1.9.2-py3-none-any.whl

Intended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Topic :: Software Development :: Libraries :: Python Modules

Tags

oauth 1.0a signature generationmastercard api authenticationrsa signing for http requestsoauth authorization headerapi request signing librarymastercard developer oauthhttp request authentication
oauth-1.0amastercard-apirequest-signing

More Python Modules packages