Python 无法断言API结果
我需要用python断言API结果 《邮差》的结果是:Python 无法断言API结果,python,api,Python,Api,我需要用python断言API结果 《邮差》的结果是: url = self.driver.current_url notice_id = url.split('/')[-1] time.sleep(3) headers = {'Authorization': 'Token tokenApp="myAppToken" Token token=' + token,"Content-Type": "application/json"} url2 = '.....' + notice_id +
url = self.driver.current_url
notice_id = url.split('/')[-1]
time.sleep(3)
headers = {'Authorization': 'Token tokenApp="myAppToken" Token token=' + token,"Content-Type": "application/json"}
url2 = '.....' + notice_id + '&type=read'
time.sleep(3)
response = requests.get(url2, headers=headers)
print(url2)
print(notice_id)
print(response.text)
assert requests['Response'] == [{"iChannelId": 2, "sChannelName": "application web", "iCount": 1}]
“答复”:[
{
“iChannelId”:2,
“sChannelName”:“应用程序web”,
“iCount”:1
}
],
那么如何断言
“iChannelId”==2
和“sChannelName”==“application web”
和“iCount”==1
?1)我不知道你的问题是什么,2)当你复制/粘贴到这里时,你的代码看起来像是被废弃了。编辑:你的问题是什么?错误是什么?那么预期的结果是什么呢?很抱歉,我不能发布问题1)我不知道你的问题是什么,2)当你复制/粘贴到这里时,你的代码似乎被废弃了。编辑:你的问题是什么?错误是什么?那么预期的结果是什么呢?很抱歉,我不能发布问题
"Response": [
{
"iChannelId": 2,
"sChannelName": "application web",
"iCount": 1
}
],