Best Python code snippet using slash
ChangeYaml.py
Source:ChangeYaml.py
1#encoding=utf-82import json3import os 4import shutil5import math6import re7from ..k8s.rbd import have_disk as have_disk8from ..k8s.rbd import get_size_need as get_size_need9basedir=os.path.split(os.path.realpath(__file__))[0]10def read_file (filename):11 f = open(filename)12 content = f.read()13 f.close()14 return content15def write_file (filename, text):16 f = open(filename, 'w')17 f.write(text)18 f.close()19def get_config(config_name):20 #*************æ°å¢æ£éªé
ç½®æ件æ¯å¦ä¸ºåæ³JSON代ç **********#21 try:22 config = json.loads(read_file(config_name))23 except:24 return 125 hosts = []26 group_num=config['GROUP_NUM']27 node_hosts = config['node_hosts']28 storage_num=config['STORAGE_NUM']29 tracker_num=config['TRACKER_SERVER_NUM']30 fastdfs_data=config['FASTDFS_DATA']31 nginx_ip=config['Nginx_Ip']32 for i in range(len(node_hosts)) :33 if node_hosts[i] not in hosts:34 hosts.append(node_hosts[i])35 return [group_num,hosts,storage_num,tracker_num,fastdfs_data,nginx_ip]36def change_tracker_yaml():37 tracker_hosts=[]38 list_config = get_config(basedir+'/'+'FastDFS.json')39 node_hosts=list_config[1]40 fastdfs_data = list_config[4]41 #ç»nodeæstorageçtable42 label_nodes = ""43 for i in range(len(node_hosts)):44 label_nodes += '/root/local/bin/kubectl label node {} fastdfs=storage{} >/dev/null 2>&1\n'.format(node_hosts[i],i)45 #ç»nodeætrackerçtable46 for i in range(len(node_hosts)):47 label_nodes += '/root/local/bin/kubectl label node {} fastdfs-tracker=tracker >/dev/null 2>&1\n'.format(node_hosts[i])48 tracker_hosts.append(node_hosts[i])49 if i==1:50 break51 tracker_shell=read_file(basedir+'/shell/install_tracker.sh')52 tracker_shell = tracker_shell.replace("&{FASTDFS_NODES_LABEL}", label_nodes)53 write_file(basedir+"/out/shell/install_tracker.sh", tracker_shell)54 #æ¿æ¢FastDFS Trackerèç¹çYAMLæ件55 tracker_stateful=read_file(basedir+"/Yaml/fastdfs-tracker-statefulset.yaml")56 tracker_stateful = tracker_stateful.replace("&{FastDFS_Data}", str(fastdfs_data))57 write_file(basedir + "/out/tracker/fastdfs-tracker-statefulset.yaml", tracker_stateful)58 return [tracker_hosts]59def change_storage_yaml():60 list_config = get_config(basedir+'/'+'FastDFS.json')61 group_num=list_config[0]62 node_num = len(list_config[1])63 storage_num=list_config[2]64 fastdfs_data=list_config[4]65 list_tracker_config=change_tracker_yaml()66 tracker_hosts=list_tracker_config[0]67 label=068 for i in range(group_num):69 for j in range(storage_num):70 storage_stateful = read_file(basedir+"/Yaml/fastdfs-storage-statefulset.yaml")71 storage_stateful = storage_stateful.replace('&{fastdfs-storage}',"fastdfs-group{}-storage{}".format(i,j))72 storage_stateful = storage_stateful.replace('&{moons}', "storage{}".format(label))73 storage_stateful = storage_stateful.replace('&{GROUP_NAME}', '\"' + "group{}".format(i) + '\"')74 storage_stateful = storage_stateful.replace('&{PORT}', '\"' + "2300{}".format(i) + '\"')75 storage_stateful = storage_stateful.replace('&{PROBE_PORT}', "2308{}".format(i))76 storage_stateful = storage_stateful.replace('&{STORAGE_NGINX_PORT}','\"'+"2308{}".format(i)+'\"')77 if len(tracker_hosts)==1:78 storage_stateful = storage_stateful.replace('&{TRACKER_NUM}'," ")79 storage_stateful = storage_stateful.replace('&{TRACKER_SERVER}', '\"'+tracker_hosts[0]+":"+"22133"+'\"' )80 storage_stateful = storage_stateful.replace('&{TRACKER_SERVER_SLAVE}'," ")81 else:82 storage_stateful = storage_stateful.replace('&{TRACKER_NUM}', '\"'+"2"+'\"')83 storage_stateful = storage_stateful.replace('&{TRACKER_SERVER}', '\"'+tracker_hosts[0]+":"+"22133"+'\"' )84 storage_stateful = storage_stateful.replace('&{TRACKER_SERVER_SLAVE}', '\"'+tracker_hosts[1]+":"+"22133"+'\"' )85 storage_stateful = storage_stateful.replace('&{FastDFS_Data}',str(fastdfs_data))86 label=label+187 if(label==node_num):88 label=089 write_file(basedir+"/out/storage/fastdfs-group{}-storage{}-statefulset.yaml".format(i,j), storage_stateful)90def change_nginx_yaml():91 nginx_stateful = read_file(basedir+'/Yaml/nginx-statefulset.yaml')92 list_config = get_config(basedir + '/' + 'FastDFS.json')93 node_num = len(list_config[1])94 nginx_nodes = ""95 for i in range(node_num):96 if i==0:97 nginx_nodes += '- name: K8S_NODE0{}_IP\n value: {}\n'.format(i, list_config[1][i])98 continue99 if i+1==node_num:100 nginx_nodes += ' - name: K8S_NODE0{}_IP\n value: {}'.format(i,list_config[1][i])101 continue102 nginx_nodes += ' - name: K8S_NODE0{}_IP\n value: {}\n'.format(i, list_config[1][i])103 nginx_stateful = nginx_stateful.replace('&{K8S_NODE_IP}', nginx_nodes)104 write_file(basedir+'/out/nginx/nginx_stateful.yaml', nginx_stateful)105def check_config():106 # *************æ°å¢æ£éªé
ç½®æ件æ¯å¦ä¸ºåæ³JSON代ç **********#107 list_config = get_config(basedir + '/' + 'FastDFS.json')108 if isinstance(list_config, int):109 print("Error!The configuration file that users fill is not the standard JSON format.")110 return 1111 #return [group_num, hosts, storage_num, tracker_num, fastdfs_data, nginx_ip]112 # *******************Add Check Config************113 group_num = list_config[0]114 storage_num = list_config[2]115 hosts = list_config[1]116 tracker_num = list_config[3]117 fastdfs_data=list_config[4]118 nginx_ip=list_config[5]119 #**************å¢å ä¸å¥æ£éªIPæ¯å¦åæ³çè¯å¥*************120 node_str = os.popen("/root/local/bin/kubectl get node|awk -F ' ' 'NR>1{print $1}'").read().strip()121 node_list = node_str.split("\n")122 for i in hosts:123 if i not in node_list:124 print("Error!The NodeIP that the user fills out does not exist in the K8S cluster")125 return 1126 if isinstance(fastdfs_data,int):127 if (int(fastdfs_data) <=0 or int(fastdfs_data) >100000000000):128 print("Error!The parameters of the FastDFS mounted disk that the user fills out must be an integer greater than 0")129 return 1130 else:131 print("Error!The parameters of FastDFS mounted disk that users fill out must be int type")132 return 1133 if isinstance(tracker_num,int):134 if int(tracker_num) != 2:135 print("Error! The tracker number must be 2")136 return 1137 else:138 print("Error! The tracker number must be 2")139 return 1 140 if isinstance(storage_num,int):141 if len(hosts)<2:142 print("Error!The node IP that the user fills in at least two")143 return 1144 elif int(storage_num) <= 0:145 print("Error!The number of storage for users to fill in FastDFS must be greater than 0")146 return 1147 elif int(storage_num) > len(hosts):148 print("Error!The number of storage that FastDFS fills out must be less than or equal to the number of node IP")149 return 1150 else:151 print("Error!The number parameter of FastDFS component Storage must be int type")152 return 1153 if isinstance(group_num, int):154 if (int(group_num) <=0 or int(group_num) >3):155 print("Error!The number of the FastDFS component groups must be 1, 2, and 3")156 return 1157 else:158 #calc_disk=int(math.ceil(int(fastdfs_data)*1.075+0.5))159 #install_disk = int(group_num) * int(storage_num) * calc_disk + 12160 161 num_temp = int(group_num) * int(storage_num)162 volumes=[{'num':num_temp,'size':fastdfs_data},{'num':4,'size':5}]163 install_disk=get_size_need(volumes)164 #print(install_disk)165 return_code = have_disk(install_disk)166 if return_code == 1:167 print("Error! Install FastDFS Cluster don't have enough disk")168 return 1169 else:170 print("Error!The number of parameters of the FastDFS component group must be the int type")171 return 1172 compile_ip = re.compile('^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$')173 if compile_ip.match(nginx_ip):174 pass175 else:176 return 1177 return [group_num,storage_num,hosts,fastdfs_data,nginx_ip]178def get_nginx_ip():179 list_config = get_config(basedir + '/' + 'FastDFS.json')180 if isinstance(list_config, int):181 print("Error!The configuration file that users fill is not the standard JSON format.")182 return "127.0.0.1"183 nginx_ip = list_config[5]184 compile_ip = re.compile('^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$')185 if compile_ip.match(nginx_ip):186 return nginx_ip187 else:188 print("Error! Nginx iP is illegal ")189 return "127.0.0.1"190def check_disk():191 list_config = check_config()192 if list_config == 1:193 return 1194 else:195 group_num = list_config[0]196 storage_num = list_config[1]197 fastdfs_data = list_config[3]198 199 num_temp = int(group_num) * int(storage_num)200 volumes=[{'num':num_temp,'size':fastdfs_data},{'num':4,'size':5}]201 install_disk=get_size_need(volumes)202 #calc_disk = int(math.ceil(int(fastdfs_data) * 1.075 + 0.5))203 #install_disk = int(group_num) * int(storage_num) * calc_disk + 24204 print("The size of the disk required to install the FastDFS cluster isï¼%s" %install_disk)205 return install_disk206def install_all():207 #********å ä¸å¥æ£æµé群æ¯å¦å·²ç»å®è£
è¿ç代ç *********#208 fastdfs_endpoints = os.popen("/root/local/bin/kubectl get endpoints |grep -ci fastdfs").read().strip()209 fastdfs_pvc = os.popen("/root/local/bin/kubectl get pvc|grep -ci fastdfs").read().strip()210 fastdfs_service = os.popen("/root/local/bin/kubectl get service | grep -ci fastdfs").read().strip()211 fastdfs_pod = os.popen("/root/local/bin/kubectl get pod | grep -ci fastdfs").read().strip()212 fastdfs_sts = os.popen("/root/local/bin/kubectl get sts | grep -ci fastdfs").read().strip()213 return_code = fastdfs_endpoints + fastdfs_pvc + fastdfs_service + fastdfs_pod + fastdfs_sts214 if int(return_code)!=0:215 print("Error!FastDFS cluster already exists, please do not repeat the installation")216 return 1217 list_config=check_config()218 if list_config==1:219 return 1220 else:221 group_num = list_config[0]222 storage_num = list_config[1]223 hosts = list_config[2]224 source_path=basedir+'/'+'FastDFS.json'225 destination_path=basedir+'/fdfs/FastDFS.json'226 destination_bak_path=basedir+'/json/Expand_FastDFS.json'227 shutil.copy(source_path, destination_path)228 shutil.copy(source_path, destination_bak_path)229 list_tracker_config = change_tracker_yaml()230 tracker_hosts=list_tracker_config[0]231 change_storage_yaml()232 change_nginx_yaml()233 print("The number of K8S node nodes isï¼%d " % len(hosts))234 print("The IP of the K8S node node isï¼%s " % (json.dumps(hosts)))235 print("The number of the group Group of the FastDFS isï¼%s " % group_num)236 print("The number of Storage under each group of Group in FastDFS isï¼%s " % storage_num)237 print("IP as the FastDFS Tracker node is:%s " % json.dumps(tracker_hosts))238 print("Start installing the Tracker node of the FastDFS cluster")239 cmd_tracker='sh '+basedir+'/out/shell/install_tracker.sh'240 os.system(cmd_tracker)241 print("End the Tracker node of the installation of the FastDFS cluster")242 print("Start installing the Storage node of the FastDFS cluster")243 cmd_storage='sh '+basedir+'/shell/install_storage.sh'244 os.system(cmd_storage)245 print("End the Storage node of the installation of the FastDFS cluster")246 cmd_storage = 'sh ' + basedir + '/shell/install_nginx.sh'247 print("Start installing the Nginx node of the FastDFS cluster")248 os.system(cmd_storage)249 print("End the Nginx node of the installation of the FastDFS cluster")250 return 0251if __name__=="__main__":252 #check_disk()253 return_code=install_all()254 if return_code==0:255 print("SUCCESS! Install FastDFS cluster success")256 else:257 print("Error! Install FastDFS cluster failure")258 nginx_ip=get_nginx_ip()...
app_tools.py
Source:app_tools.py
1import pandas as pd2import numpy as np3import json4import os5import settings6import ml_tools7import datetime8from tensorflow.keras.models import load_model9# with open(settings.conf_u_path) as config_file:10# conf = json.load(config_file)11# data = pd.read_excel(settings.ex_data, sheet_name='data')12# data['DateTime'] = pd.to_datetime(data['DateTime'])13# data.set_index('DateTime', inplace=True)14# #data = data[:-120]15# data = data.astype(float)16# #data = data['ENERGY']17# data[conf["y_var"]].astype(float)18#---------------------------------------------19def get_lib_models():20 list_model = []21 list_config = []22 model_type = '_u'23 with os.scandir(settings.app_models_path) as folders:24 folders = [folders.name for folders in folders if folders.is_dir()] 25 26 for folder in folders:27 with os.scandir(settings.app_models_path +'/' +folder ) as files:28 files = [files.name for files in files if files.is_file() and files.name.endswith(model_type +'.h5')]29 model = load_model(settings.app_models_path +'/' + folder +'/' +files[0])30 list_model.append(model)31 with os.scandir(settings.app_models_path +'/' +folder ) as files:32 files = [files.name for files in files if files.is_file() and files.name.endswith('config.json')]33 with open(settings.app_models_path +'/' + folder +'/' +files[0]) as config_file:34 conf = json.load(config_file)35 list_config.append(conf)36 return list_config, list_model37def get_lib_models_config():38 list_config = []39 with os.scandir(settings.app_models_path) as folders:40 folders = [folders.name for folders in folders if folders.is_dir()] 41 42 for folder in folders:43 with os.scandir(settings.app_models_path +'/' +folder ) as files:44 files = [files.name for files in files if files.is_file() and files.name.endswith('config.json')]45 with open(settings.app_models_path +'/' + folder +'/' +files[0]) as config_file:46 conf = json.load(config_file)47 list_config.append(conf)48 return list_config, folders49def get_model_by_folderindex(folders, index):50 model_type = '_u'51 with os.scandir(settings.app_models_path +'/' + folders[index] ) as files:52 files = [files.name for files in files if files.is_file() and files.name.endswith(model_type +'.h5')]53 model = load_model(settings.app_models_path +'/' + folders[index] +'/' +files[0], compile=False)54 return model55 56#---------------------------------------------57def dict_compare(d1, d2):58 d1_keys = set(d1.keys())59 d2_keys = set(d2.keys())60 shared_keys = d1_keys.intersection(d2_keys)61 same = set(o for o in shared_keys if d1[o] == d2[o])62 return same63#---------------------------------------------64#list_config, list_model = get_lib_models()65def find_model(list_config, list_model, query):66 foud_index=None67 for i in range(len(list_config)):68 if dict_compare(list_config[i], query) == set(query.keys()):69 foud_index=i70 if foud_index is None:71 return [],[]72 else:73 return list_model[foud_index], list_config[foud_index]74def find_model_by_config(list_config, query):75 foud_index=None76 for i in range(len(list_config)):77 if dict_compare(list_config[i], query) == set(query.keys()):78 foud_index=i79 if foud_index is None:80 return [],[]81 else:82 return list_config[foud_index], foud_index83#------------------------------------------------84 85def get_data_2_predict(data, conf, date):86 #data= data[conf["y_var"]]87 date_time_str = date88 date_time_obj = datetime.datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S')89 last_val = date_time_obj - datetime.timedelta(hours= 1)90 first_val = last_val - datetime.timedelta(hours= conf["past_hist"])91 data = data.loc[first_val:last_val]92 if len(data) != conf["past_hist"]:93 data=data.iloc[1:]94 data_r, data_mean, data_std = ml_tools.normalize(data[conf["y_var"]].values)95 data_r.reshape((len(data_r),1))96 return data, data_r, data_mean, data_std97#---------------------------------------------98def make_prediccion(model, n_ahead, data, data_r, data_mean_2, data_std_2):99 data_r.reshape((len(data_r),1))100 yhat = ml_tools.predict_n_ahead(model, n_ahead, data_r)101 yhat = ml_tools.desnormalize(np.array(yhat), data_mean_2, data_std_2)102 yhat = ml_tools.model_out_tunep(yhat)103 #-----------------------------------------------104# graphs.plot_next_forecast(data, yhat, n_ahead, save=True)105 fc = ml_tools.forecast_dataframe(data, yhat, n_ahead)106 return fc107#----------------------------------------------------108def compare_df(data_master,fc):109 p_df = fc.loc[fc["type"]=='forecast'] 110 t_strt = p_df["DateTime"].iloc[0]111 t_end = p_df["DateTime"].iloc[-1]112 r_df = data_master.loc[t_strt:t_end]113# r_mean = r_df["ENERGY"].values.mean()114# r_sum = r_df["ENERGY"].values.sum()115 comp_df = fc116 comp_df.set_index("DateTime", inplace = True)117 comp_df = comp_df.rename(columns = {'ENERGY':'Prediccion'})118 r_df= r_df["ENERGY"]119 comp_df = comp_df.join(r_df)120 comp_df = comp_df.rename(columns = {'ENERGY':'Real'})121 comp_df.Real.fillna(comp_df.Prediccion, inplace=True)122 return comp_df123def comp_stats(comp_df):124 comp = comp_df.loc[comp_df["type"]=='forecast']125 p_mean = comp["Prediccion"].values.mean()126 p_sum = comp["Prediccion"].values.sum()127 p_max = comp["Prediccion"].values.max()128 r_mean = comp["Real"].values.mean()129 r_sum = comp["Real"].values.sum()130 r_max = comp["Real"].values.max()131 stats_dic={'Suma':[p_sum, r_sum],'Media':[p_mean, r_mean],'Máximo':[p_max, r_max]}132 stats_df = pd.DataFrame(stats_dic, index=['Prediccion', 'Real'])133 return stats_df...
student_list.py
Source:student_list.py
1# Copyright 2012 the Melange authors.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14"""Module containing template with a list of GCIOrganization entities."""15from django.utils.translation import ugettext16from melange.logic import profile as profile_logic17from soc.views.helper import addresses18from soc.views.helper import lists19from soc.views.helper.url import urlize20from soc.views.template import Template21from soc.modules.gci.views.helper import url_names22class StudentList(Template):23 """Component for listing all the students in GCI."""24 def __init__(self, data):25 self.data = data26 self.idx = 127 list_config = lists.ListConfiguration()28 list_config.setRowAction(29 lambda entity, *args: data.redirect.profile(30 entity.profile_id).urlOf(url_names.GCI_STUDENT_TASKS))31 list_config.addSimpleColumn('public_name', 'Public Name')32 list_config.addSimpleColumn('profile_id', 'Username')33 list_config.addPlainTextColumn(34 'email', 'Email', lambda entity, *args: entity.contact.email)35 list_config.addSimpleColumn('first_name', 'First Name', hidden=True)36 list_config.addSimpleColumn('last_name', 'Last Name')37 list_config.addBirthDateColumn(38 'birth_date', 'Birth date', lambda entity, *args: entity.birth_date,39 hidden=True)40 list_config.addSimpleColumn('gender', 'Gender')41 addresses.addAddressColumns(list_config)42 list_config.addPlainTextColumn(43 'school_id', 'School name',44 lambda entity, *args: entity.student_data.education.school_id,45 hidden=True)46 list_config.addPlainTextColumn(47 'school_country', 'School Country',48 lambda entity, *args: entity.student_data.education.school_country,49 hidden=True)50 list_config.addPlainTextColumn(51 'grade', 'Grade',52 lambda entity, *args: entity.student_data.education.grade, hidden=True)53 list_config.addPlainTextColumn(54 'expected_graduation', 'Expected Graduation',55 lambda entity, *args: entity.student_data.education.expected_graduation,56 hidden=True)57 list_config.addPlainTextColumn(58 'number_of_completed_tasks', 'Completed tasks',59 lambda entity, *args: entity.student_data.number_of_completed_tasks)60 def formsSubmitted(entity, form_type):61 """Returns "Yes" if form has been submitted otherwise "No".62 form takes either 'consent' or 'student_id' as values which stand63 for parental consent form and student id form respectively.64 """65 if form_type == 'consent':66 return 'Yes' if entity.student_data.consent_form else 'No'67 elif form_type == 'enrollment':68 return 'Yes' if entity.student_data.enrollment_form else 'No'69 else:70 raise ValueError('Unsupported form type: %s' % form_type)71 list_config.addPlainTextColumn(72 'consent_form', 'Consent Form Submitted',73 lambda entity, *args: formsSubmitted(entity, 'consent'))74 list_config.addPlainTextColumn(75 'enrollment_form', 'Student ID Form Submitted',76 lambda entity, *args: formsSubmitted(entity, 'enrollment'))77 list_config.addPlainTextColumn(78 'home_page', 'Home Page',79 lambda entity, *args: entity.contact.web_page, hidden=True)80 list_config.addPlainTextColumn(81 'blog', 'Blog',82 lambda entity, *args: entity.contact.blog, hidden=True)83 list_config.addSimpleColumn('tee_style', 'T-Shirt Style')84 list_config.addSimpleColumn('tee_size', 'T-Shirt Size')85 list_config.addHtmlColumn(86 'photo_url', 'Photo URL',87 (lambda entity, *args: urlize(entity.photo_url)), hidden=True)88 list_config.addSimpleColumn(89 'program_knowledge', 'Program Knowledge', hidden=True)90 self._list_config = list_config91 def getListData(self):92 idx = lists.getListIndex(self.data.request)93 if idx != self.idx:94 return None95 query = profile_logic.queryAllStudentsForProgram(self.data.program.key())96 starter = lists.keyStarter97 response_builder = lists.RawQueryContentResponseBuilder(98 self.data.request, self._list_config, query, starter)99 return response_builder.buildNDB()100 def templatePath(self):101 return'modules/gci/students_info/_students_list.html'102 def context(self):103 list_configuration_response = lists.ListConfigurationResponse(104 self.data, self._list_config, idx=self.idx)105 return {106 'name': 'students',107 'title': 'Participating students',108 'lists': [list_configuration_response],109 'description': ugettext(110 'List of participating students'),...
verifyURL.py
Source:verifyURL.py
1import csv2import requests3import urllib34import json5import threading6urllib3.disable_warnings()7from datetime import datetime8headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36"}9class ValidURL():10 def __init__(self):11 pass12 def execVerify(self, list_config):13 for list_config in list_config:14 system = (list_config[:list_config.find('=')]).strip()15 url = (list_config[list_config.find('=') + 1:]).strip()16 threading.Thread(target=self.validUrl,args=(url, system)).start()17 def validUrl(self, url, system):18 conterror = 319 while (conterror > 0):20 try:21 if ('WSO2' in system):22 params = {"date": ""+str(datetime.now().strftime('%m%Y'))+""}23 result = requests.post(url, verify=False, timeout=10, data=json.dumps(params),headers=headers).status_code24 else:25 result = requests.get(url, verify=False, timeout=10, headers=headers).status_code26 except:27 result = 9999928 if (result == 200):29 result = 'DISPONIVEL'30 conterror = 031 else:32 result = 'INDISPONIVEL'33 conterror -= 134 # --------------------------- Grava Resultado no arquivo Local ---------------------------35 with open('C:/Automations/validUrl/results/resultValidUrl.csv', 'a+', newline='') as file:36 writer = csv.writer(file, delimiter=';')37 writer.writerow([system, str(datetime.now().strftime('%d/%m/%Y')), str(datetime.now().strftime('%H:%M')), result])...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!