mastercard-oauth1-signer
Mastercard OAuth1 Signer.
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-signeruv
uv add mastercard-oauth1-signerpoetry
poetry add mastercard-oauth1-signerInstalling 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
mohawkMohawk implements the Hawk HTTP authorization…
copyleft · top 5,000 on PyPI
requests-oauthAdds OAuth 1.0 authentication support to the…
permissive · top 5,000 on PyPI
aws-request-signerSigns HTTP requests using AWS Signature V4,…
permissive · top 15,000 on PyPI
turnkey-api-key-stamperSigns Turnkey API requests with your API key…
permissive · top 15,000 on PyPI
py-order-utilsGenerates and cryptographically signs orders…
permissive · top 5,000 on PyPI
python-jwtGenerates and verifies JSON Web Tokens (JWTs)…
permissive · top 15,000 on PyPI
requests-oauthlibAdds OAuth 1 and OAuth 2 authentication support…
permissive · top 1,000 on PyPI
requests-sigv4Adds AWS Signature Version 4 signing to…
permissive · top 5,000 on PyPI
endesiveEndesive signs and verifies digital signatures…
unclear · top 15,000 on PyPI
turnkey-httpTurnkey HTTP is an HTTP client for the Turnkey…
permissive · top 15,000 on PyPI