Inventree Python-API: Minimales API-Verbindungsbeispiel mit YAML-Config
English
Deutsch
Dieses Beispiel ermöglicht es Ihnen, eine Config-Datei inventree.yml zu erstellen:
inventree.yml
server: 'https://inventree.mydomain.com'
username: 'admin'
password: 'Chuiquu5Oqu8il5ahLoja4aecai4ee'und diese dann in Python einzulesen und sich mit der Inventree-API zu verbinden:
inventree_connect.py
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"])If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow