def get_requestdata_to_file(self, sn): ''' request json file :param sn: :return: ''' try: global logcat_object logcat_object = co.Set_Logcat_Message(sn) filelist = package.update_fota_package() platform_information.set_device("tbox") platform_information.set_vin_version(filelist[5]) platform_information.set_sw_version_new(filelist[7]) platform_information.set_sw_version_old(filelist[7]) platform_information.set_mcu_version(filelist[8]) data_json = platform_information.temporary_get_port_data(platform_information.get_vin_version(), platform_information.get_device(), \ platform_information.get_sw_version_old(),\ platform_information.get_mcu_version()) header = platform_information.get_header( platform_information.get_vin_version()) # print(header) # print(data_json) co.post_request(sn, header, data_json) return co.post_request_to_file(sn, header, data_json) except Exception as e: logger.log_error("%s" % (e), sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name, sys._getframe().f_lineno) return 1
def temporary_prepare_post_request(self,sn): try: filelist = package.update_fota_package() platform_information.set_device("hu") # platform_information.set_vin_version(platform_information.get_vin_verbose(sn)) platform_information.set_vin_version(filelist[5]) platform_information.set_sw_version_new(filelist[2]) platform_information.set_sw_version_old(filelist[3]) platform_information.set_mcu_version(filelist[6]) data_json = platform_information.temporary_get_port_data(platform_information.get_vin_version(), platform_information.get_device(), \ platform_information.get_sw_version_old(),\ platform_information.get_mcu_version()) print(data_json) header = platform_information.get_header(platform_information.get_vin_version()) return co.post_request(sn,header,data_json) except Exception as e: logger.log_error("%s" %(e),sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno) return 1