我已经用Selenium python编写了一个脚本,我被困在要对http://localhost:0000/v1/s3status进行get调用的位置,并且输出将类似于附件中的图像。{{3} }
datasources= requests.get("http://localhost:0000/v1/s3status")
我正在寻找一种解决方案,其中我只需要脚本输出仅特定值,阶段:{},已验证:{},失败:{}
因此python脚本的输出应类似于:
Datasources of Staged :{Whatever the result will be inside}
Datasources of Failed :{Whatever the result will be inside}
Datasouces of Validated :{Whatever the result will be inside}
答案 0 :(得分:0)
首先,您需要将请求转换为json。
import json
import requests
datasources= requests.get("http://localhost:0000/v1/s3status").json()
print("Staged : {}".format(datasources['staged']))
print("Failed : {}".format(datasources['failed']))
print("Validated : {}".format(datasources['validated']))