mkmsdk


Namemkmsdk JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://github.com/silvanocerza/mkm-sdk
SummaryMagicKardMarket sdk
upload_time2023-07-24 21:35:48
maintainer
docs_urlNone
authorSilvano Cerza
requires_python
licenseMIT
keywords mkm magickardmarket magiccardmarket sdk mtg magic the gathering card market rest tcg trading card game pokemon wow world of warcraft yugioh
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            # 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

-   Python 3.8, 3.9, 3.10, 3.11
-   [Requests](http://docs.python-requests.org/)
-   [Requests_OAuthlib](https://github.com/requests/requests-oauthlib/)

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/silvanocerza/mkm-sdk",
    "name": "mkmsdk",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "mkm magickardmarket magiccardmarket sdk mtg magic the gathering card market rest tcg trading card game pokemon wow world of warcraft yugioh",
    "author": "Silvano Cerza",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/1b/77/a02102fc7a1a5402dadcbd8ce34eed4183fafc36f020ab1eb387f3020b1b/mkmsdk-0.6.0.tar.gz",
    "platform": null,
    "description": "# Magic Kard Market Python SDK\n\n[![image](https://badge.fury.io/py/mkmsdk.png)](http://badge.fury.io/py/mkmsdk)\n\n[![image](https://readthedocs.org/projects/mkm-sdk/badge/?version=latest)](http://mkm-sdk.readthedocs.org/en/latest/)\n\n[![image](https://coveralls.io/repos/evonove/mkm-sdk/badge.svg)](https://coveralls.io/r/evonove/mkm-sdk)\n\n[![image](https://travis-ci.org/evonove/mkm-sdk.svg)](https://travis-ci.org/evonove/mkm-sdk)\n\nA simple SDK for dedicated and widget apps working with Magic Kard\nMarket.\n\n# Contributing\n\nFeel free to contribute! Submit [a PR following the\nguidelines](https://mkm-sdk.readthedocs.io/en/latest/contributing.html#pull-request-guidelines/)\nand it will be alright.\n\n# Requirements\n\n-   Python 3.8, 3.9, 3.10, 3.11\n-   [Requests](http://docs.python-requests.org/)\n-   [Requests_OAuthlib](https://github.com/requests/requests-oauthlib/)\n\n# Setup\n\nFrom the command line:\n\n    pip install mkmsdk\n\nFor the SDK to work properly you need to create four environment\nvariables holding the tokens necessary to create the authorization to\nmake requests. You can find them in your Magic Kard Market account page\nunder the apps section.\n\n-   `MKM_APP_TOKEN`\n-   `MKM_APP_SECRET`\n-   `MKM_ACCESS_TOKEN`\n-   `MKM_ACCESS_TOKEN_SECRET`\n\n[MKM_ACCESS_TOKEN]{.title-ref} and [MKM_ACCESS_TOKEN_SECRET]{.title-ref}\nneed to be set to empty string if you want to use a widget app.\n\n# Usage\n\nFirst thing to do is import the [Mkm]{.title-ref} class and the API map:\n\n    from mkmsdk.mkm import Mkm\n    from mkmsdk.api_map import _API_MAP\n\nInstance a new instance of Mkm:\n\n    # Using API v1.1\n    mkm = Mkm(_API_MAP[\"1.1\"][\"api\"], _API_MAP[\"1.1\"][\"api_root\"])\n    # Using API v2.0\n    mkm = Mkm(_API_MAP[\"2.0\"][\"api\"], _API_MAP[\"2.0\"][\"api_root\"])\n\nIf you want to test on Magic Card Market\\'s sandbox you must use the\nsandbox root endpoint:\n\n    mkm_sandbox = Mkm(_API_MAP[\"2.0\"][\"api\"], _API_MAP[\"2.0\"][\"api_sandbox_root\"])\n\nTo make a request:\n\n    response = mkm.account_management.account()\n\n    # Formats an endpoint\n    response = mkm.market_place.user(user='SampleUser')\n\n    # Call endpoint with specified parameters\n    response = mkm.account_management.vacation(params={\"onVacation\": \"false\"})\n\nThis will return a\n[Response](http://docs.python-requests.org/en/latest/api/?highlight=response#requests.Response/)\nobject that contains the response from the server.\n\nNote that only [market_place]{.title-ref} requests work when using a\nwidget app.\n\nTo get a json you can call response.json().\n\n# Tests\n\nIntegration tests will be skipped if the four environment variables are\nnot set.\n\n-   `MKM_APP_TOKEN`\n-   `MKM_APP_SECRET`\n-   `MKM_ACCESS_TOKEN`\n-   `MKM_ACCESS_TOKEN_SECRET`\n\nNote that some tests will be skipped depending if\n[MKM_ACCESS_TOKEN]{.title-ref} and [MKM_ACCESS_TOKEN_SECRET]{.title-ref}\nare empty strings or not.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "MagicKardMarket sdk",
    "version": "0.6.0",
    "project_urls": {
        "Homepage": "https://github.com/silvanocerza/mkm-sdk"
    },
    "split_keywords": [
        "mkm",
        "magickardmarket",
        "magiccardmarket",
        "sdk",
        "mtg",
        "magic",
        "the",
        "gathering",
        "card",
        "market",
        "rest",
        "tcg",
        "trading",
        "card",
        "game",
        "pokemon",
        "wow",
        "world",
        "of",
        "warcraft",
        "yugioh"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6fa3a4e7d603898280d0d1041722ae6e443d220149538189d42f8e586b3e797f",
                "md5": "d0c3f01c5011e4acd0c05068a6b57d8c",
                "sha256": "bc40983d22b940a46ebd990b104f051de91425f05212164eca0d089a27267102"
            },
            "downloads": -1,
            "filename": "mkmsdk-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d0c3f01c5011e4acd0c05068a6b57d8c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12405,
            "upload_time": "2023-07-24T21:35:46",
            "upload_time_iso_8601": "2023-07-24T21:35:46.788633Z",
            "url": "https://files.pythonhosted.org/packages/6f/a3/a4e7d603898280d0d1041722ae6e443d220149538189d42f8e586b3e797f/mkmsdk-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b77a02102fc7a1a5402dadcbd8ce34eed4183fafc36f020ab1eb387f3020b1b",
                "md5": "c27e76bed7ab6a504ead7d0fe618ba03",
                "sha256": "c2e3df176c2789946c68c202d6ed93e8f5adc4e8ce5de53b3c18aa345594e8ff"
            },
            "downloads": -1,
            "filename": "mkmsdk-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c27e76bed7ab6a504ead7d0fe618ba03",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12113,
            "upload_time": "2023-07-24T21:35:48",
            "upload_time_iso_8601": "2023-07-24T21:35:48.262153Z",
            "url": "https://files.pythonhosted.org/packages/1b/77/a02102fc7a1a5402dadcbd8ce34eed4183fafc36f020ab1eb387f3020b1b/mkmsdk-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-24 21:35:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "silvanocerza",
    "github_project": "mkm-sdk",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "mkmsdk"
}
        
Elapsed time: 0.10753s