Get in touch

Get in touch

Prefer using email? Say hi at hello@moveshelf.com

In this section we will explain how you can import the Moveshelf API into your processing script to securely interact with Moveshelf.
Prerequisites
Before implementing this example, ensure that you have performed all necessary setup steps. In particular, you should have:
Configure the Moveshelf API
Add the following lines of code to your processing script to use the Moveshelf API:
import os, sys, json
parent_folder = os.path.dirname(os.path.dirname(__file__))
sys.path.append(parent_folder)
from moveshelf_api.api import MoveshelfApi
from moveshelf_api import util

## Setup the API
# Load config
personal_config = os.path.join(parent_folder, "mvshlf-config.json")
if not os.path.isfile(personal_config):
    raise FileNotFoundError(
        f"Configuration file '{personal_config}' is missing.\n"
        "Ensure the file exists with the correct name and path."
    )

with open(personal_config, "r") as config_file:
    data = json.load(config_file)

api = MoveshelfApi(
    api_key_file=os.path.join(parent_folder, data["apiKeyFileName"]),
    api_url=data["apiUrl"],
)