inopia / mkm-sdk

Python SDK for Magickartenmarkt API

Home Page:https://www.magiccardmarket.eu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Magic Kard Market Python SDK

https://badge.fury.io/py/mkmsdk.png https://readthedocs.org/projects/mkm-sdk/badge/?version=latest

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

Contributing

Feel free to contribute! Submit a PR following the 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 and MKM_ACCESS_TOKEN_SECRET need to be set to empty string if you want to use a widget app.

Usage

First thing to do is import mkm to work on live servers or mkm_sandbox for the sandbox:

from mkmsdk.mkm import mkm, mkm_sandbox

A request works like this:

response = mkm.account_management.account()

response = mkm.market_place.user(user='SampleUser')

This will return a Response object that contains the response from the server.

Note that only market_place 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 and MKM_ACCESS_TOKEN_SECRET are empty strings or not.

About

Python SDK for Magickartenmarkt API

https://www.magiccardmarket.eu/

License:MIT License


Languages

Language:Python 100.0%