fetch data by ID

master
Marek Isalski 2 years ago
parent 5bdebd8e63
commit 4e27779299

@ -137,7 +137,7 @@ class APIObject(object):
self._api = api self._api = api
self.id = id self.id = id
if data: if data:
self.id = int( data.get("id", None) ) self.id = int(data.get("id", None))
self._data = data self._data = data
@classmethod @classmethod
@ -147,7 +147,10 @@ class APIObject(object):
@property @property
def data(self): def data(self):
if self._data is None: if self._data is None:
self._data = self._api.get(self.makeUrl()) if self.id:
self._data = self._api.get(self.makeUrl(id=self.id))
else:
self._data = self._api.get(self.makeUrl())
return self._data return self._data
@data.setter @data.setter

Loading…
Cancel
Save