Skip to main content

MagicKardMarket sdk

Project description

# Fork of mkm-sdk project

This is fork of mkm-sdk project [Original repo](https://github.com/silvanocerza/mkm-sdk).<br>

This fork was created to update the endpoint address in the mkm library, as the maintainer of the original project has not yet responded to [PR](https://github.com/silvanocerza/mkm-sdk/pull/2).

# 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkmsdk2-0.7.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkmsdk2-0.7.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file mkmsdk2-0.7.0.tar.gz.

File metadata

  • Download URL: mkmsdk2-0.7.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for mkmsdk2-0.7.0.tar.gz
Algorithm Hash digest
SHA256 b300077716eba0a7dd4683621e277d9cb85588aa9f863965e0a467b66d9f3eed
MD5 69c29894bdd15f5cd809df3855fc9c72
BLAKE2b-256 464a83e55ba3d1884d4449884355ef5d47b08c39b249a6c4d72ccaf055fcc6ff

See more details on using hashes here.

File details

Details for the file mkmsdk2-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: mkmsdk2-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for mkmsdk2-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92685e1c109ffc21b6132fa10f712c804c5e5352e13aefcd997151b0c93a76ea
MD5 e8f535f234f57dafb55b52a8a07c49ea
BLAKE2b-256 007b3b113459a7f4fd7eae2f8d6d9a762e8a1bd3896549ca2e7029f754391426

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page