from grocy.request import Request from grocy.conf import Configuration import logging class Stock(object): GET_STOCK_URL_TEMPLATE = '{api}/stock' def __init__(self): self.conf = Configuration() self.conf.load() def get(self): logger = logging.getLogger('stock.get') url = self.GET_STOCK_URL_TEMPLATE.format(api=self.conf.api) request = Request('get', url) try: return request.send() except Exception as e: logger.error(e) raise e