grocy-cli/grocy/models/schema.py

16 lines
564 B
Python

from grocy import RestService
import logging
class Schema(object):
def _init_rest_service(self):
if hasattr(self, 'api'):
if self.api.startswith == '/':
self.api = self.api[1:]
if self.api.endswith == '/':
self.api = self.api[1:-1]
self.rest_service = RestService(self.api, json=True)
self.rest_service.addHeader('Content-Type', 'application/json')
self.rest_service.addHeader('Accept', 'application/json')
self.rest_service.addToken(self.token)