Skip to main content

MagicKardMarket sdk

Project description

# 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

mkmsdk-0.6.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

mkmsdk-0.6.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file mkmsdk-0.6.0.tar.gz.

File metadata

  • Download URL: mkmsdk-0.6.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for mkmsdk-0.6.0.tar.gz
Algorithm Hash digest
SHA256 c2e3df176c2789946c68c202d6ed93e8f5adc4e8ce5de53b3c18aa345594e8ff
MD5 c27e76bed7ab6a504ead7d0fe618ba03
BLAKE2b-256 1b77a02102fc7a1a5402dadcbd8ce34eed4183fafc36f020ab1eb387f3020b1b

See more details on using hashes here.

File details

Details for the file mkmsdk-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: mkmsdk-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for mkmsdk-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc40983d22b940a46ebd990b104f051de91425f05212164eca0d089a27267102
MD5 d0c3f01c5011e4acd0c05068a6b57d8c
BLAKE2b-256 6fa3a4e7d603898280d0d1041722ae6e443d220149538189d42f8e586b3e797f

See more details on using hashes here.

Supported by

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