Commit 9ba8ec8b by 文鑫

增加获取用例severity的方法

parent 1251b0e3
......@@ -17,9 +17,10 @@ class DoExcelByPandas(object):
test_data = []
# 获取行号索引,并对其进行遍历
for i in df.index.values:
# 根据i获取该行的数据,并通过to_dict转化成字典 -- 这里不能用iloc, iloc只能用数字索引
row_data = df.loc[i, ['id', 'url', 'data', 'story', 'severity']].to_dict()
# 根据i获取该行的数据,通过[]指定需要获取的字段,并通过to_dict转化成字典 -- 这里不能用iloc, iloc只能用数字索引
row_data = df.loc[i, ['severity']].to_dict()
test_data.append(row_data)
return test_data
for i in test_data: #遍历字典,并取出severity的值
return i['severity']
......@@ -4,15 +4,14 @@ import re
def get_SourceId(sourceName):
response = requests.get('http://10.197.236.159:8014/web/data-source/base/find-pools')
data = response.json()['data']
text = ''
for i in data:
if i['dataSourceName'] == sourceName:
data = response.json()['data'] #访问获取数据源的接口,并取出其中的data内容
text = '' #定义一个字符串
for i in data: #遍历data内容(list)
if i['dataSourceName'] == sourceName: #将sourceName等于传入参数的内容取出
# print(i)
text = i
pattern = re.compile("'dataSourceId': '(\d+)'")
pattern = re.compile("'dataSourceId': '(\d+)'") #使用正则匹配的方式,获取其中的sourceID
id = ''.join(pattern.findall(str(text)))
return id
# print(id)
# print('http://10.197.236.159:8014/web/data-source/base/remove/'+id)
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment