Inventree Python API: Minimal API connect example using YAML config
This example allows you to create a config file inventree.yml
:
server: 'https://inventree.mydomain.com'
username: 'admin'
password: 'Chuiquu5Oqu8il5ahLoja4aecai4ee'
and then read it in Python and connect to the Inventree API:
from inventree.api import InvenTreeAPI
# Load config
import yaml
with open("inventree.yml", "r") as file:
config = yaml.safe_load(file)
api = InvenTreeAPI(config["server"], username=config["username"], password=config["password"])