https://github.com/samuelmarks/mastercard-python
Python SDK for MasterCard's API. Unofficial.
https://github.com/samuelmarks/mastercard-python
Last synced: over 1 year ago
JSON representation
Python SDK for MasterCard's API. Unofficial.
- Host: GitHub
- URL: https://github.com/samuelmarks/mastercard-python
- Owner: SamuelMarks
- Created: 2015-01-29T08:01:18.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-02-06T14:55:45.000Z (over 11 years ago)
- Last Synced: 2025-01-28T04:32:02.234Z (over 1 year ago)
- Language: Python
- Size: 160 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
mastercard-python
=================
A wrapper of MasterCard's HTTPS APIs in Python.
Currently in pre-alpha, recommend awaiting the 1.0.0 release.
#Setup
You'll need a few environment variables set, specifically:
MC_CLIENT_ID
MC_PRIVATE_KEY
MC_API_OR_SANDBOX
Example value for `MC_API_OR_SANDBOX`:
sandbox.api
Additionally there is an optional variable:
MC_CERTIFICATE
`MC_PRIVATE_KEY` can be a path to a '.jks' file, in such a case ensure you should include any password.
#Use
# Instantiate 1-2 variables
mc_oauth = OAuth1(client_key=client_key, signature_method=SIGNATURE_RSA, rsa_key=private_key)
mc = master_card(mc_oauth)
# Then call the API method you want
mc('merchant', 'merchants')
This `mc` object additionally supports an:
- `id` field (usually a numeral after the first two nouns).
- query params (as a arguments, e.g.: `mc('', '', PageLength=50)`), these will replace any defaults
Results of the `mc` object currently include:
- `status_code`, the HTTP response status code
- `xml`, the resulting content
- `url`, the URL the request was sent to
See `MasterCard.py` for an example with pretty-printing.