def setUp(self): cfg_info = NewConfig() self.common, self.headers = cfg_info.get_info(devices_name="vivox6") self.t = LoginApi() self.access_token = self.t.get_access_token(self.common, self.headers) self.s_detail = GetServiceDetail(self.common, self.headers, self.access_token) self.response = self.s_detail.get_service_detail()
def setUp(self): cfg_info = NewConfig() self.common, self.headers = cfg_info.get_info(devices_name="vivox6") self.t = LoginApi() self.access_token = self.t.get_access_token(self.common, self.headers) self.ex_p90 = PostExperience(self.common, self.headers, self.access_token) self.services_info = GetServiceInfo(self.common, self.headers, self.access_token) self.task_info = GetTaskInfo2(self.common, self.headers, self.access_token) self.at_result = GetAllArtTrainResultAnswer(self.common, self.headers, self.access_token)
def setUp(self): cfg_info = NewConfig() self.common, self.headers = cfg_info.get_info() t = LoginApi() self.access_token = t.get_access_token(self.common, self.headers) self.sevicesID = t.get_user_study_center(self.common, self.headers, self.access_token) get_measure_id = GetMeasureInfo(self.common, self.headers, self.access_token) _, self.mID, _ = get_measure_id.get_sys_id(self.sevicesID) self.report = GetMeasureReport(self.common, self.headers, self.access_token)
def setUpClass(cls): cfg_info = NewConfig() common, headers = cfg_info.get_info(devices_name="vivox6") t = LoginApi() cls.access_token = t.get_access_token(common, headers) cls.sevicesID = t.get_user_study_center(common, headers, cls.access_token) cls.sys = GetMeasureInfo(common, headers, cls.access_token) cls.mWords = GetMeasureWords(common, headers, cls.access_token) cls.word_postAnswer = PostMeasureWords(common, headers, cls.access_token) cls.mGra = GetMeasureGra(common, headers, cls.access_token) cls.gra_postAnswer = PostMeasureGra(common, headers, cls.access_token) cls.mLis = GetMeasureListen(common, headers, cls.access_token) cls.lis_postAnswer = PostMeasureLis(common, headers, cls.access_token) cls.mRead = GetMeasureRead(common, headers, cls.access_token) cls.rid_postAnswer = PostMeasureRead(common, headers, cls.access_token) cls.mWrite = GetMeasureWrite(common, headers, cls.access_token) cls.wri_postAnswer = PostMeasureWrite(common, headers, cls.access_token)
for task in datas.get("GRA"): finish_gra(task, common, headers, access_token) if datas.get("LIS"): for task in datas.get("LIS"): t = threading.Thread(target=finish_lis, args=(task, common, headers, access_token)) t.start() if datas.get("WRI"): for task in datas.get("WRI"): t = threading.Thread(target=finish_wri, args=(task, common, headers, access_token)) t.start() if __name__ == '__main__': cfg_info = NewConfig() devices = cfg_info.get_info('vivox6') common, headers = cfg_info.get_info("vivox6") print(common, headers) t = LoginApi() access_token = t.get_access_token(common, headers) print("access_token:".capitalize(), access_token) while True: try: step1 = GetServiceInfo(common, headers, access_token) step1_ids = step1.get_service_id() servicesID, _, _, = step1_ids print("Step1 return:", step1_ids) step2 = GetTaskInfo(common, headers, access_token) step2_ids = step2.get_task_id(servicesID) print("step2_ids", step2_ids)
self.accesstoken = accesstoken self.headers.update({"accesstoken": self.accesstoken}) def post_measure_words(self, measureID, curr_status, userAnswer): url = "{}/userMeasure/{}/measureData".format(self.baseUrl, measureID) print(url) # ,"studyType":"VOC","sysQuestID":"100-0","userAnswer":"2" for c, u in zip(curr_status, userAnswer): if c == 0: data = {"elapsedSec":29,"stepType":0} data.update(u) print("data", data) print("headers", self.headers) response = requests.request("POST", url, headers=self.headers, json=data) print("response.text", response.text) if len(eval(response.text).get('data')) != 0: return eval(response.text).get('data') else: pass if __name__ == '__main__': cfg_info = NewConfig() devices = cfg_info.get_info('vivox6') c, h = cfg_info.get_info("vivox6") print(c) print(h) a = 'dad46a52-0542-4f39-a371-3b47e05af4b8' at = GetMeasureWords(c, h, a) s = at.get_measure_words(0)
class GetServiceDetail(object): def __init__(self, common, headers, accesstoken): self.headers = headers self.baseUrl = common.get('baseUrl') self.accesstoken = accesstoken self.headers.update({"accesstoken": self.accesstoken}) def get_service_detail(self): url = "{}/services/detail".format(self.baseUrl) self.headers.update({'Content-Length': '0'}) response = requests.request("GET", url, headers=self.headers) datas = json.loads(response.text).get('data') s_overiew = datas.pop('serviceOverview') for s in s_overiew: datas.update(s) return datas if __name__ == '__main__': cfg_info = NewConfig() common, headers = cfg_info.get_info(devices_name="vivox6") t = LoginApi() access_token = t.get_access_token(common, headers) print(common) print(headers) print(access_token) s_detail = GetServiceDetail(common, headers, access_token) r = s_detail.get_service_detail() print(r)
def setUp(self): cfg_info = NewConfig() self.common, self.headers = cfg_info.get_info() self.t = LoginApi()