def getDeviceTags(self, registrationId): if registrationId.strip() == '': return {'status': -1, 'error': 'registrationId is null'} path = '%s%s%s' % (self.deviceUrl, '/tags/', registrationId) req = tools().web_get(path, '') tags = req.get("tags") return tags
def cleanDeviceTags(self, registrationId): if registrationId.strip() == '': return {'status': -1, 'error': 'registrationId is null'} path = '%s%s' % (self.deviceUrl, '/tags') jsondata = {'registrationId': registrationId, "opType": 3} req = tools().web_post(path, jsondata) error = req.get("error") if error is None or error.strip() == '': return json.dumps({'status': 200}) else: return req
def setDeviceAlias(self, registrationId, alias): if registrationId.strip() == '': return {'status': -1, 'error': 'registrationId is null'} path = '%s%s' % (self.deviceUrl, '/alias') jsondata = {'alias': alias, 'registrationId': registrationId} req = tools().web_post(path, jsondata) error = req.get("error") if error is None or error.strip() == '': return json.dumps({'status': 200}) else: return req
def sendPush(self, pushwork): if pushwork is None: return {'status': -1, 'error': 'pushwork is null'} appkey = pushwork['appkey'] if appkey is None or appkey.strip() == '': return {'status': -1, 'error': 'appkey is null'} target = pushwork['target'] if target is None: return {'status': -1, 'error': 'target is null'} type = pushwork['type'] if type is None: return {'status': -1, 'error': 'type is null'} content = pushwork['content'] if content is None: return {'status': -1, 'error': 'content is null'} path = '%s%s' % (self.pushUrl, "/v2/push") result = tools().web_post(path, pushwork) return result
def getStatsByBatchId(self, batchId): if batchId.strip() == '': return {'status': -1, 'error': 'batchId is null'} path = '%s%s%s' % (self.statsUrl, "/stats/id/", batchId) result = tools().web_get(path, '') return result
def getStatsByWorkno(self, workno): if workno.strip() == '': return {'status': -1, 'error': 'workno is null'} path = '%s%s%s' % (self.statsUrl, "/stats/workno/", workno) result = tools().web_get(path, '') return result