1、取出返回值中的具体的某个值
# 取出token值 tmpToken = d2['data']["tmpToken"]
2、返回值的读取ret_login_tmp.headers,ret_login_tmp.json()
ret_login_tmp = requests.post(url_login_tmp, data=json.dumps(params_login_tmp), headers=headers_tmp) print ("==============") cookie = ret_login_tmp['data']["Set-Cookie"] print (ret_login_tmp.headers) print (ret_login_tmp.json())
3、报错'Response' object is not subscriptable
cookie = ret_login_tmp['data']["Set-Cookie"] print (ret_login_tmp.headers) print (ret_login_tmp.json())
问题报错:TypeError: 'Response' object is not subscriptable
(subscriptable:可下标的)
原因:返回的类型还未转换为json格式,就进行获取参数的操作