Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions fonAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ def getdevice(self, device, position=None, brand=None):
return result.json()
except AttributeError:
return result

def getlatestdevices(self, brand=None, limit=None):
"""
Get latest devices and return a json list
:param brand:
:param limit:
:return device list:
"""
url = self.__ApiUrl + 'getlatest'
postdata = {'brand': brand,
'limit': limit,
'token': self.__ApiKey}
headers = {'content-type': 'application/json'}
result = self.sendpostdata(url, postdata, headers)
try:
return result.json()
except AttributeError:
return result

def sendpostdata(self, url, postdata, headers, result = None):
"""
Expand Down