Skip to main content

# Magic Kard Market Python SDK

[![image](https://badge.fury.io/py/mkmsdk.png)](http://badge.fury.io/py/mkmsdk)

[![image](https://readthedocs.org/projects/mkm-sdk/badge/?version=latest)](http://mkm-sdk.readthedocs.org/en/latest/)

[![image](https://coveralls.io/repos/evonove/mkm-sdk/badge.svg)](https://coveralls.io/r/evonove/mkm-sdk)

[![image](https://travis-ci.org/evonove/mkm-sdk.svg)](https://travis-ci.org/evonove/mkm-sdk)

A simple SDK for dedicated and widget apps working with Magic Kard Market.

# Contributing

Feel free to contribute! Submit [a PR following the guidelines](https://mkm-sdk.readthedocs.io/en/latest/contributing.html#pull-request-guidelines/) and it will be alright.

# Requirements

# Setup

From the command line:

pip install mkmsdk

For the SDK to work properly you need to create four environment variables holding the tokens necessary to create the authorization to make requests. You can find them in your Magic Kard Market account page under the apps section.

  • MKM_APP_TOKEN

  • MKM_APP_SECRET

  • MKM_ACCESS_TOKEN

  • MKM_ACCESS_TOKEN_SECRET

[MKM_ACCESS_TOKEN]{.title-ref} and [MKM_ACCESS_TOKEN_SECRET]{.title-ref} need to be set to empty string if you want to use a widget app.

# Usage

First thing to do is import the [Mkm]{.title-ref} class and the API map:

from mkmsdk.mkm import Mkm from mkmsdk.api_map import _API_MAP

Instance a new instance of Mkm:

# Using API v1.1 mkm = Mkm(_API_MAP[“1.1”][“api”], _API_MAP[“1.1”][“api_root”]) # Using API v2.0 mkm = Mkm(_API_MAP[“2.0”][“api”], _API_MAP[“2.0”][“api_root”])

If you want to test on Magic Card Market's sandbox you must use the sandbox root endpoint:

mkm_sandbox = Mkm(_API_MAP[“2.0”][“api”], _API_MAP[“2.0”][“api_sandbox_root”])

To make a request:

response = mkm.account_management.account()

# Formats an endpoint response = mkm.market_place.user(user=’SampleUser’)

# Call endpoint with specified parameters response = mkm.account_management.vacation(params={“onVacation”: “false”})

This will return a [Response](http://docs.python-requests.org/en/latest/api/?highlight=response#requests.Response/) object that contains the response from the server.

Note that only [market_place]{.title-ref} requests work when using a widget app.

To get a json you can call response.json().

# Tests

Integration tests will be skipped if the four environment variables are not set.

  • MKM_APP_TOKEN

  • MKM_APP_SECRET

  • MKM_ACCESS_TOKEN

  • MKM_ACCESS_TOKEN_SECRET

Note that some tests will be skipped depending if [MKM_ACCESS_TOKEN]{.title-ref} and [MKM_ACCESS_TOKEN_SECRET]{.title-ref} are empty strings or not.

Metadata

Release files for mkmsdk 0.7.0

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

Source distribution (sdist)

Source distribution for mkmsdk 0.7.0
File Size Uploaded Provenance Actions
mkmsdk-0.7.0.tar.gz 12.3 kB Without provenance Details for mkmsdk-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mkmsdk 0.7.0
File Interpreter ABI Platform Actions
mkmsdk-0.7.0-py3-none-any.whl Python 3 none any Details for mkmsdk-0.7.0-py3-none-any.whl

Total release size: 24.8 kB

Release files / mkmsdk-0.7.0.tar.gz

Download URL mkmsdk-0.7.0.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6bbd1207792dc720bda474296a170551048009aa564a6375010fdc982090e43f
BLAKE2b-256 checksum
How to use checksums
e535577b9e12d466bdb486208702828b494cbefb83e9ab4aa5830db38e901333
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / mkmsdk-0.7.0-py3-none-any.whl

Download URL mkmsdk-0.7.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e44f6abee247e13b671e08915c011723cd964bf71c4e670ab476138c0ff473f0
BLAKE2b-256 checksum
How to use checksums
5d7042d692688291f2b13c632cad5078cb2727f602e6959c3b43379317e64177
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for mkmsdk 0.7.0

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