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.id = id
if data:
self.id = int( data.get("id", None) )
self.id = int(data.get("id", None))
self._data = data
@classmethod
@ -147,7 +147,10 @@ class APIObject(object):
@property
def data(self):
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
@data.setter

Loading…
Cancel
Save