【发布时间】:2016-07-29 10:07:02
【问题描述】:
header = {'Content-type': 'application/json','Authorization': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }
url = 'https://sandbox-authservice.priaid.ch/login'
response = requests.post(url, headers = header, verify=False).json()
token = json.dumps(response)
print token['ValidThrough']
我想在我的 webhook 中打印 ValidThrough 属性,该属性通过 POST 调用作为 JSON 数据接收。我知道这已经被问过很多次了,但是 print token['ValidThrough'] 对我不起作用。我收到错误“TypeError: string indices must be integers, not str”
【问题讨论】:
-
是的,它也是返回值,它有两个属性,'Token' 和 'ValidThrough'