Skip to content
A python client for Grocy (Data management only)
Python
Branch: master
Clone or download

README.md

pygrocydm

Build Status CodeFactor Coverage Status PyPI Automated Release Notes by gren DeepSource FOSSA Status

Installation

pip install pygrocydm

Documentation

Check Grocy API

https://blueblueblob.github.io/pygrocydm/

Usage

Import the package:

from pygrocydm import GrocyDataManager

Obtain a grocy data manager instance:

gdm = GrocyDataManager("https://example.com", "GROCY_API_KEY")

or

gdm = GrocyDataManager("https://example.com", "GROCY_API_KEY", port = 9192, verify_ssl = True)

Product list :

products = gdm.products()
products_list = products.list
for product in products_list:
    print(vars(product))
    if product.name == "Cookies":
        product.delete()
    if product.name == "Chocolate":
        data = {}
        data['name'] = "Choco"
        product.edit(data)
else:
    new_product = {}
    new_product['name'] = 'Cookies'
    new_product['location_id'] = 1
    new_product['qu_id_purchase'] = 1
    new_product['qu_id_stock'] = 1
    new_product['qu_factor_purchase_to_stock'] = 1
    new_product_id = products.add(new_product)

License

FOSSA Status

You can’t perform that action at this time.