How to use the mkmsdk.mkm.Mkm function in mkmsdk

To help you get started, we’ve selected a few mkmsdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github evonove / mkm-sdk / tests / tests_integration / test_mkm.py View on Github external
def mkm_sandbox20(scope="module"):
    return Mkm(_API_MAP["2.0"]["api"], _API_MAP["2.0"]["api_sandbox_root"])
github evonove / mkm-sdk / tests / tests_unit / test_mkm.py View on Github external
def mkm():
    return Mkm(_API_MAP["1.1"]["api"], _API_MAP["1.1"]["api_sandbox_root"])
github evonove / mkm-sdk / tests / tests_integration / test_mkm.py View on Github external
def mkm_sandbox(scope="module"):
    return Mkm(_API_MAP["1.1"]["api"], _API_MAP["1.1"]["api_sandbox_root"])
github mtgjson / mtgjson / mtgjson4 / mtgjson4 / compile_mtg.py View on Github external
def build_mtgjson_set(
    sf_cards: List[Dict[str, Any]], set_code: str, skip_keys: bool
) -> Dict[str, Any]:
    """
    Compile the entire XYZ.json file and pass it off to be written out
    :param skip_keys: Skip building TCGPlayer & MKM components
    :param sf_cards: Scryfall cards
    :param set_code: Set code
    :return: Completed JSON file
    """
    LOGGER.info(f"> BUILDING {set_code}.json <")

    if not skip_keys and os.environ["MKM_APP_TOKEN"] and os.environ["MKM_APP_SECRET"]:
        MKM_API.set(Mkm(_API_MAP["2.0"]["api"], _API_MAP["2.0"]["api_root"]))

    mtgjson_set_file: Dict[str, Any] = {}

    # Get the set config from Scryfall
    set_config = scryfall.download(scryfall.SCRYFALL_API_SETS + set_code)
    if set_config["object"] == "error":
        LOGGER.error(f"Set Config for {set_code} was not found, skipping...")
        return {"cards": [], "tokens": []}

    mtgjson_set_file["name"] = set_config["name"].strip()
    mtgjson_set_file["code"] = set_config["code"].upper()
    mtgjson_set_file["type"] = set_config["set_type"]
    mtgjson_set_file["keyruneCode"] = (
        pathlib.Path(set_config["icon_svg_uri"]).name.split(".")[0].upper()
    )
github mtgjson / mtgjson / mtgjson5 / providers / cardmarket.py View on Github external
super().__init__(headers or {})

        config = self.get_configs()
        os.environ["MKM_APP_TOKEN"] = config.get("CardMarket", "app_token")
        os.environ["MKM_APP_SECRET"] = config.get("CardMarket", "app_secret")
        os.environ["MKM_ACCESS_TOKEN"] = ""
        os.environ["MKM_ACCESS_TOKEN_SECRET"] = ""

        if not (os.environ["MKM_APP_TOKEN"] and os.environ["MKM_APP_SECRET"]):
            LOGGER.warning("MKM keys not established. Skipping requests")
            self.__keys_found = False
            return

        self.__keys_found = True

        self.connection = Mkm(_API_MAP["2.0"]["api"], _API_MAP["2.0"]["api_root"])
        self.set_map = {}
        self.__init_set_map()
github evonove / mkm-sdk / mkmsdk / mkm.py View on Github external
def __getattr__(self, name):
        """
        Used to get inside the api_map

        Params:
            `name`: api_map entry to get

        Returns:
            `instance`: Return an instance of Mkm with updated api_map
        """

        instance = Mkm(api_map=self.api_map[name], root_endpoint=self.root_endpoint)
        setattr(self, name, instance)
        return instance